Click here to hide categories Click here to show left categories

User: Home          welcome : Guest          Log In / Register here     

How to find controls in content page from another content page in

This article explains how we can find the controls from content page to content. First we will find the contentplaceholder of Master page. Because all content pages inheriting reference of that contentplaceholder.

in This example we have two content pages. Content1.aspx and Content2.aspx. Now we need to search the label "lblHeading" placed on Content1.aspx, from another content page. named Content2.aspx. Now we will put below code on Content2.aspx to search the label

ContentPlaceHolder contentPage = Page.MasterPage.FindControl("ContentPlaceHolder1") as ContentPlaceHolder;
Label lblHead =(Label)contentPage.FindControl("lblHeading");

Share this article   |    Print    |    Article read by 5755 times
Rohit kakria
I am software developer, moderator of
Related Articles:
Related Interview Questions: