如何在ASP.net中获取页面中的Div页面?

Bri*_*tel 8 html asp.net master-pages web-applications content-pages

我在我的Web应用程序中使用母版页.现在我正在创建多个内容页面.Master页面中有一个Div有标签.现在我想在一个内容页面中隐藏Div,而在其他内容页面中的其他要求是获取Div内的标签.

那么如何隐藏主页面中的Div,来自内容页面以及如何从内容页面中获取该Div中定义的标签?

st *_*nmn 18

在主页面中添加div属性:runat="server" 然后在内容页面中编写以下代码来访问div:

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

祝好运!