How to find controls in content page from another content page in asp.net
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"); Response.Write(lblHead.Text);
http://
http://
Contributed by:
Rohit kakria
I am software developer, moderator of xpode.com
Resourse address on xpode.com
http://www.xpode.com/Print.aspx?Articleid=629
Click here to go on website
|