|
If you want the event handler of Control present in master page, in your content page, you can go do something like this:
protected void Page_Init(object sender, EventArgs e)
{
Button btn = (Button)this.Master.FindControl("btnMaster");
if (btn != null)
btn.Click += new EventHandler(btn_Click);
}
protected void btn_Click(object sender, EventArgs e)
{
Response.Write("Button Clicked.");
}
where btnMaster is a Button in Master Page. I guess you need to do the same for Menu Item.
amit_83 wrote: so i wanted make it at client side without triping
If you want to do it in client side, there is no concept of master and content page. Try with some javascript based on the client side code it generated.
|
|
|
|
|
hi,
i was added two template fields in Grid view one="Drop Down List" two="Text Box",here i need to disable text box while Drop_down_on_Change event with some selection Fields only ,my requirement is like,
"Drop Down List" has two items , one is "Country" and Second one is "State",
if user Select country in Drop Down then Text box should be disable false else Text box should be disable True (i need client side code).Please suggest me better way to fix.
Thanks & Regards,
Vishnu.
|
|
|
|
|
Hi Guys i have a data format like this format...,
<table>
<tr><td>Head1</td><td>Head2</td><td>Head3</td></tr>
<tr><td colspan='3'>some value</td></tr>
<tr><td>value1</td><td>value2</td><td>value3</td></tr>
<tr><td>value1</td><td>value2</td><td>value3</td></tr>
<tr><td>value1</td><td>value2</td><td>value3</td></tr>
<tr><td colspan='3'>some value dasfs</td></tr>
<tr><td>value1</td><td>value2</td><td>value3</td></tr>
<tr><td>value1</td><td>value2</td><td>value3</td></tr>
</table>
Now i want to export the values to .CSV format...,
In lower version of .CSV(2000) its showing datas properly...,
the same thing if i open in 2007 CSV format...,
i am getting the records how i mentioned in above(table) the sme way i am getting (i.e) with table...,
this is my code:
string strData = "<table>.......</table> //the above table format i given here
Response.Write(strData);
byte[] data = ASCIIEncoding.ASCII.GetBytes(strData);
Response.Clear();
Response.ContentType = "text/csv";
Response.AddHeader("content-disposition", "attachment;filename=" + _UserID + "Stock" + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + ".csv");
Response.BinaryWrite(data);
Response.End();
plz help me regards this...,
Thanks & Regards,
Member 3879881,
please don't forget to vote on the post
|
|
|
|
|
I don't see where you said what the actual problem is.
There is no such thing as CSV2000 or CSV2007. CSV stands for comma separated values. It is a text file. HTML is not CSV. Telling an application you are giving it CSV data when you are actually giving it HTML would definitely lead to unpredictable results. If you want to save as CSV then do the parsing to actual produce CSV. Load your HTML into either an HTMLTable object or an XMLDocument object and create a proper CSV. Since you are not using the proper quotes for your attributes it may be a little tricky
|
|
|
|
|
((parentPage)Parent.Page).callChildMethod();
As above i called a method which assigns parent control Label to new values from user control server side page, i debug the code and it showed me the value is changed correctly which is to be, when the method call gets over it comes inside the user control again and leaves the User control but when the page doesnot showing the changed values unless we give click on the parent page to load again.
Method inside Parent .aspx.cs Page which Holds User Control
public void callChildMethod()
{
Label1.text="value";
}
Above Label Value gets changed when i call method but the page not getting refreshed to show the new values.
|
|
|
|
|
Hi!
AFAICT, you are approaching the problem in the wrong way.
If you refresh the child control it's via async postback. This means that the browser will refresh only the area associated with the control. IT WILL NOT REFRESH parent controls.
What you see is being updated is the server side counterpart of the parent control's label, which is reconstructed over and over by asp.net at each partial postback.
If you want to update the parent control's label, you should probably do it via javascript and ClientScriptManager (if you are already using Ajax extensions).
I hope this can clarify you what's actually happening!
Bye
|
|
|
|
|
hi
Yes, i agree can you give me some example how can we do that .,
|
|
|
|
|
Hi everyone,
I have one question I can't seem to find an answer for...
Is there a simple way to ensure an aspx file deployed to a remote server has not been modified?
I'm thinking of something a bit like strong name signing: a way to detect at run time if the aspx file has been modified after deployment.
I mean: I can compile every aspx.cs file into a dll and sign the resulting file, but it seems I cannot do something similar with aspx files.
Thank you all in advance.
Alberto
|
|
|
|
|
When you pre-compile the application the code behind and aspx files placed into the assembly, there are aspx files also but they are merely placeholders (even says so in the file)
If you have are worried about someone changing the aspx after deployment then I think you have other concerns that need to be addressed first.
I know the language. I've read a book. - _Madmatt
modified on Wednesday, September 1, 2010 1:44 PM
|
|
|
|
|
Mark Nischalke wrote: When you compile the application the code behind and aspx files placed into the assembly, there are aspx files also but they are merely placeholders (even says so in the file)
IIRC that is a build option and not the default option?
|
|
|
|
|
Correct, I should have clarified that.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Thank you Mark and Ennis!
Yes, I know that I have a lot of things to watch for before.
In fact, taking care of them is my current concern.
I was simply investigating if it's possible to secure this particular aspect of a webapp.
Thank you much for answering to my question.
I think I can't find the exact option you two are referring to; could you tell me how it's called (I should probably RTFM, I know).
Thank you much!
|
|
|
|
|
|
|
Hi All,
I am currently fighting with a problem with regards to finding controls within ContentPlaceHolders.
The scenario is that I want to be able to set the class on a control with a specified ID, which is on one of the Master pages which the page inherits from. There is no limit to how many levels up the tree the control can be, and the code searches recursively until the root master page. This part I have working.
The issue that I am having is that I can only find a control if it is on the root master page.(I.e. not within a ContentPlaceHolder). If the control is on any other page then FindControl() does not find the control. In this example, the control would only be found if on DefaultMaster.
DefaultMaster
--> SectionMaster
--> PageMaster
--> Page.aspx
I have investigated further, and found that controls within a Content control are being retured as null, although they clearly exist. Obviously as these are null, FindControl can't find them. I have tried attempting to find a control within the content section also, but I have the same issue.
Unfortunately, if you take the above example, then my control would be in SectionMaster, as I dont have access to the root master page. (I'm using Umbraco currently for this project.)
Does anyone have any suggestions to how to get these values from content controls?
Thanks in advance,
DM.
|
|
|
|
|
What event in the Page Lifecycle is your code running? Child controls generally will not be available until after the load event fires for said control.
That said, code is not supposed to access controls up the hierarchy only below it. If you need to access something from your parent container, the parent should provide a method to perform said action. Otherwise you introduce unmanageable dependencies.
|
|
|
|
|
I'm using the Page_Load event on the User Control.
What I do at first is a FindControl() on the current control, if its not found, it does a a FindControl() on the page which the control is on. If thats not found, it looks at the Master for that Page and continues to do this until the control is found, or it is the root masterpage.
It only seems to find controls outwith the content place hold on the root masterpage or nested content controls. Interestingly, on the Controls collection, it shows the correct number of the page, however some are shown as null. I'm sure the nulls are where my controls I need to find are.
Thanks
DM
|
|
|
|
|
Hi All,
I am new to Windows7 and IIS7 environments. Here at client site, I have a machine in which I am not finding ASP.Net state service in my services list. Is there any way to add ASP.Net state service to the services list. I need this service to be added because the application I am running is using ASP.Net state server services. Any link or any explanation would be great helpfull.
I need this support for Windows7 and IIS7.
Thanks & Regards,
Md. Abdul Aleem
NIIT technologies
|
|
|
|
|
Windows 7 isn't a server operating system. If your site is big enough to require state services it should be running on a server OS. Also depending on how you use the website you may be violating the license agreement for the desktop OS if you are serving a website for multiple users.
|
|
|
|
|
Hi,
I am getting System.Web.HttpCompileException from my application randomnly. it gets fixed randomnly too. sometimes i refresh the IIS and it starts working, other times, i change timestamp on the control mentioned in exception and my application starts working. My code looks like:
Private utilityMethods As ASP.mywebsite_utilitymethods_ascx 'Declaration , This line is throwing error. Note this is global declaration of the reference
after the above line i create the object and use it to call methods in the utilitymethods control. The Products page has this declaration. Sometimes when i make changes to Products page and copy it to the testbox, this exception starts happening: Please not that line 55 is the declaration line that i have copied above
Message: System.Web.HttpCompileException: D:\MyWebsite\Products.ascx.vb(55): error BC30002: Type 'ASP.mywebsite_utilitymethods_ascx' is not defined. at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath) at System.Web.UI.TemplateControl.LoadControl(String virtualPath) at Website.MyWebsite.RadTabStrip.RadMultiPage1_PageViewCreated(Object sender, RadMultiPageEventArgs e) in D:\Websites\RadTabStrip.ascx.vb:line 906 at Telerik.Web.UI.RadMultiPage.OnPageViewCreated(RadMultiPageEventArgs eventArgs) at Telerik.Web.UI.RadMultiPage.AddedControl(Control control, Int32 index) at System.Web.UI.ControlCollection.Add(Control child) at Telerik.Web.UI.RadPageViewCollection.Add(RadPageView pageView) at MyWebsite.RadTabStrip.AddPageView(RadTab tab) in website\RadTabStrip.ascx.vb:line 1074 at MyWebsite.RadTabStrip.Page_Load(Object sender, EventArgs e) in D:\Websites\RadUCTabStrip.ascx.vb:line 668
Please note that the application is working. This happens sometimes when i make changes to Products page. When this happens, i change timestamp on utility methods or radtabstip page and copy it over and it starts working. I know my statement is rediculous. This is a bug but i am not sure why its happening .
Please provide help and advise.
Thanks,
Mark
|
|
|
|
|
Quick question:
A department I am working for has asked that I come some functionality on their web site for their users. The site holds student data broken down by schools. The users with schools that have a large number of students want to be able to go from the page that lists all of their students to the student's information page and then back to the list starting where they left off. The list of students is presented in a gridview control, so I was wondering if there was a way I could save where the user was in the gridview so that when they finish looking at a student's information they can start back on the gridview from where they started from.
|
|
|
|
|
Yes there are numerous ways to get at your goal.
|
|
|
|
|
|
Your link requires a registered user.
|
|
|
|
|
Oops. When I first clicked on it from google it worked without registration. Either use the cached version or look for one of the other of hundreds of articles about using the MaintainScrollPositionOnPostback directive.
|
|
|
|