Reputation: 1
Is it possible to get all controls from a ChildPage from the MasterPage the child is nested in?
I need all the controls within my form tag, but when i use a MasterPage i cant see the controls from the ChildPage, only the ones in the MasterPage.
Anyone with a good solution on this one? :)
Upvotes: 0
Views: 1681
Reputation: 21630
Here's a great article on some more advanced master page topics. I believe your situation is covered.
http://odetocode.com/articles/450.aspx
Upvotes: 1
Reputation: 1238
Suppose you have a Label control as [Label1] on the child page.
So to access that child page control from the master page, i would use
Label lbl = (Label)this.ContentPlaceHolder1.FindControl("Label1");
lbl.Text = "I got you";
So to get all the controls simply do this:
ContentPlaceHolder1.Controls
Upvotes: 2