怎样向label 传递一个值
我想做的是一个WEB系统,用户登录后,在导航栏显示用户名。在.aspx页面用label显示用户名,而在.ascx.cs页面怎么将我想要的值传递到.aspx页面中的lable里面呢?
.aspx页面的部分代码; <asp:LoginView ID= "loginView " runat= "server ">
<AnonymousTemplate>
<asp:Label ID= "lblUnLogin " runat= "server " CssClass= "LoginTip " ForeColor= "White "
Text= "你尚未未登陆 "> </asp:Label>
</AnonymousTemplate>
<LoggedInTemplate>
<asp:LoginName ID= "loginUserID " runat= "server " Font-Bold= "True " ForeColor= "White " /> //而这个显示的是用户ID代码
<asp:Label ID= "Label1 " runat= "server " Text= "Label "> </asp:Label> //我想往这个Label1中显示用户名
<asp:Label ID= "lblLogin " runat= "server " CssClass= "LoginTip " ForeColor= "White " Text= ",你好! "> </asp:Label>
</LoggedInTemplate>
</asp:LoginView>
------解决方案--------------------我明白了,是这么回事啊,原来你找不到Label
Label lb= (Label)loginView.FindControl( "Label1 ");
lb.Text = "abcd ";