Thursday, September 6, 2007

ASP.NET findControl usage in Master page

In our project we had a real time scenario of capturing the control at runtime in the User Control and setting the property for that. The page design is as follows. There is a master page and content page. The content page has a user control and few div . At runtime the user control has to identifiy one of the Div's in the content page and set the property for that page.

To capture the div in the user control
use the following.
Control cr = (Control)this.Parent.FindControl(DIVName)

KeyWords : UserControl, FindControl, MasterPage, ContentPage

No comments: