【发布时间】:2016-03-14 10:06:26
【问题描述】:
我需要在内容页中的命令按钮 (btnLogin) 的单击事件中更改母版页中标签控件 (lblCustomerLogin) 的文本属性
我试过这个:
Public Property LoginCustomerName () as string
Get
return lblcustomerlogin.text
End Get
Set(ByVal value as string)
lblcustomerlogin.text=value
End set
End Property
然后我将其添加到内容页面:
<%@ MasterType VirtualPath="~/Masterpage.master" %>
并且在内容页面按钮点击事件代码后面,我已经这样做了:
master.LoginCustomerName ="Test"
我也试过了:
dim LabelCustomerLogin as label= Directcast(master.findcontrol("lblcustomerlogin",label)
LabelCustomerLogin.text ="Test"
问题是母版页中的标签控件(lblCustomerLogin)在按钮单击时没有获取新的文本值。但是当我移动代码(master.logincustomername="test")加载内容页面的事件时,它可以工作。我如何让它在按钮点击事件中工作。
【问题讨论】: