我正在Web应用程序中使用母版页。现在我正在创建多个内容页面。母版页中有一个带有标签的Div。现在我想隐藏在一个内容页面的Div和其他内容页面的其他要求是获得标签,这是内部的Div。
那么,如何从内容页中隐藏母版页中Div,以及如何从内容页中获取在Div中定义的标签?
发布于 2012-04-17 15:07:12
将属性:runat="server"添加到母版页中的目录中,然后在内容页中编写以下代码来访问该目录:
Control c= this.Master.FindControl("masterDiv");// "masterDiv"= the Id of the div.
c.Visible = false;//to set the div to be hidden.祝好运!
https://stackoverflow.com/questions/10186295
复制相似问题