如何隐藏加载内容页面上的母版div? [英] how to hide a div of master page on load content page ?
本文介绍了如何隐藏加载内容页面上的母版div?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
受保护的 Sub Page_Load( ByVal 发件人作为 对象, ByVal e As System.EventArgs)句柄 我 .Load
txtUsername.Focus()
我 .Master.FindControl( NavigationMenu)。Visible = False
我 .Master.FindControl( btnsignup) .Visible = True
我 .Master.FindControl( btnlogout)。 Visible = False
Me .Master.FindControl( Label2)。Visible = False
< span class =code-keyword> Me .Master.FindControl( lblloginuser ).Visible = False
结束 Sub
这些都工作得很好但是当我在div上应用它时错误
对象引用未设置为对象的实例。
Me.Master.FindControl(divwelcome)。可见=假
我该怎么做
plz help
谢谢
解决方案
Hello Neeraj,
试试这个
在此页面的页面加载事件中添加以下代码
Dim navDiv 作为 HtmlContainerControl = DirectCast (我 .Master.FindControl( divwelcome),HtmlContainerControl)
navDiv.Visible = 错误
或
检查aspx的id和runat =server
< div id =divwelcomerunat =server >
最好的:)请回来寻求支持。
我们应该在div中使用runat =server
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
txtUsername.Focus()
Me.Master.FindControl("NavigationMenu").Visible = False
Me.Master.FindControl("btnsignup").Visible = True
Me.Master.FindControl("btnlogout").Visible = False
Me.Master.FindControl("Label2").Visible = False
Me.Master.FindControl("lblloginuser").Visible = False
End Sub
these all are worked fine but when i'm apply this on div then error
Object reference not set to an instance of an object.
Me.Master.FindControl("divwelcome").Visible = False
what me should to do
plz help
thanks
解决方案
Hello Neeraj,
Try this
In the page load event of this page add the following code
Dim navDiv As HtmlContainerControl = DirectCast(Me.Master.FindControl("divwelcome"), HtmlContainerControl) navDiv.Visible = False
Or
check the aspx for id and runat= "server"
<div id="divwelcome" runat="server">
All the best:) pls write back for support.
we should use runat="server" in div
这篇关于如何隐藏加载内容页面上的母版div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文