linkbutton相关问题 [英] linkbutton related question
本文介绍了linkbutton相关问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在主页面中使用名称为linkin的linkbutton进入登录表单。在我使用linkbutton登录表单后,我想在主页面中将linkbutton的名称更改为注销。
部分 类网站
继承 System.Web.UI.MasterPage
受保护的 Sub Page_Load( ByVal sender As 对象, ByVal e As System.EventArgs)句柄 我 .Load
我 .Label1.Text =会话( name )
Me .Label1.Visible = True
我 .Label3.Visible = 真
结束 Sub
受保护 Sub LinkButton1_Click( ByVal sender As 对象, ByVal e As System.EventArgs )句柄 LinkButton1.Click
我 .LinkButton1.Text = 退出
我 .Response.Redirect( Login.aspx)
结束 Sub
< span class =code-keyword>结束 类
i使用它不起作用。我可以这样做吗
解决方案
由于LinkButton1是触发此事件的控件,为什么不处理当前发送者在这里?
Dim 按钮作为 LinkButton = TryCast (发件人,LinkButton)
button.Text = 退出
你确定你是吗?登录后需要将用户重定向到login.aspx页面?对我来说,这似乎是一个逻辑错误。 的
i use linkbutton with name as signin in master page for go to login form. after i go to login form by using linkbutton then i want to change the name of linkbutton as signout in master page.
Partial Class Site
Inherits System.Web.UI.MasterPage
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.Label1.Text = Session("name")
Me.Label1.Visible = True
Me.Label3.Visible = True
End Sub
Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton1.Click
Me.LinkButton1.Text = "Sign out"
Me.Response.Redirect("Login.aspx")
End Sub
End Class
i used this it not work.how can i do it
解决方案
Since LinkButton1 is the control that triggers this event, why don't you handle the current sender here?
Dim button As LinkButton = TryCast(sender, LinkButton) button.Text = "Sign out"
Are you sure you're required to redirect the user to login.aspx page once he has logged in? For me, this seems to be a logical error here.
这篇关于linkbutton相关问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文