I have a usercontrol for header in the masterpage. I need to an attribute ‘linkName’ from some of the content pages. ie for some pages it should be
<uc1:AdminHeader ID="Adminheader1" runat="server" linkClass="adminHeaderSelected" link="manageData"></uc1:AdminHeader>
and in few other pages it should be
<uc1:AdminHeader ID="AdminHeader1" runat="server" linkName="adminusers"></uc1:AdminHeader>
how can i acheive this througn content pages?
Add a public property
LinkNameto your MasterPage that get/set the UserControl’s property.Then you can set it from the page in the following way:
Where
MyMasteris the actual type of your MasterPage.VB.NET:
Edit: If you want to add an non-existing attribute at runtime:
Create a method
AddHeaderAttribute:VB.NET
Call this method in the way described above, for example
http://msdn.microsoft.com/en-us/library/system.web.ui.usercontrol.attributes.aspx