and I want change it's color in behind code so I wrote:
(this.Master.FindControl("HyperLink1") as HtmlGenericControl).Style["color"] = "black";
but below error happen:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.Source Error:
Line 14: (this.Master.FindControl("ADMenuMessage") as HtmlGenericControl).Style["background-image"] = Page.ResolveUrl("~/Image/ADactivmenu.png");
Line 15: (this.Master.FindControl("HyperLink1") as HtmlGenericControl).Style["color"] = "black";
Line 16: }
Line 17: }
how I can change hyperlink textcolor in behind code?
how to remove master page prefix from control ID after rendering content page
i m using master page in my web application, i am using a java script that works on one of my div id and i am genrating div at run time using C# code, problem is that one one of my content page rendred a prefix ct100 attached on that div,
How can i remove that prefix from my server side control (assume panel) id
Can I modify the properties of a content page control from an event fired from the master page?create a delegate and event on master page wire up the master page in the content page create the event handler (function) on the content page modify for example:
contents of the Text property of a textbox render a control visible (or hidden) etc...
on master page, i have declared a label control & set value to it.now on content page, i m able to find the control, but the value is alwasy null & not the one which was set.when i debugged, content page's load event is called first, after that the master page is called.so where should i access the master page control so that i get the set value.