setting a controls properties within a master page from aspx page without code behind

I have a custom header control that has a public property TabID declared in the codebehind of the control itself.

In asp1.1, I dragged the header control to a page and set the tabid like: <uc1:myheader runat="server" TabID="1" /> inside the aspx page it was placed.

Now I would like to put the header control inside a master page, but I'm not sure how to set this property without setting it in codebehind for every page i create.  Is this possible?

What is the best way to get this value to the header control as it is different for every page?



8/2/2008 2:14:15 PM 13714 articles. 0 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 48

If you create a public property in the masterpage like this

public int(or whatever) HeaderTabID{

    get { return this.[usercontrolID].TabID; }

    set { this.[usercontrolID].TabID = value; }

If you do this you can set the property in pages mark up. Like how you set the Title of the masterpage


8/2/2008 2:20:02 PM

Mikael Eliasson:
If you do this you can set the property in pages mark up.


Thank you for the reply.  I am trying to see if I can do it wothout code behind in the aspx page. I will be creating hundreds of pages and it seems very tedious.

Is there a better architecture for setting page settings?  I would like to save settings for meta tags, title and some id for each page to pass to the header control without having to clutter the web.config.

Any help is greatly appreciated.


8/4/2008 2:25:12 PM