How to get Div from the main page on the ASP.net page?

I use the main page in my web application. Now I am creating several pages of content. There is one div on the main page with a shortcut. Now I want to hide this Div on one content page, and the other requirements on another content page is to get the label that is inside the Div.

So, how to hide the Div that is on the main page, on the content page, and how to get the label defined on this Div from Content page?

+7
source share
1 answer

add the attribute: runat="server" to the div on the main page and then on the content page write the following code to access the div:

  Control c= this.Master.FindControl("masterDiv");// "masterDiv"= the Id of the div. c.Visible = false;//to set the div to be hidden. 

Good luck

+17
source

All Articles