asp:LinkButton不工作 [英] asp:LinkButton not working
本文介绍了asp:LinkButton不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
添加了一个asp:LinkButton控件来遍历重定向页面,但没有处理onClick事件。
Plz帮帮我。
代码在这里...
< asp:LinkButton ID = lnkLogin runat = server 文字 < span class =code-keyword> = [登录]
字体下划线 = false onclick = lnkLogin_Click > < / asp:LinkButton >
页面后面的代码...
public partial class 主页:System.Web.UI.Page
{
受保护 void Page_Load( object sender,EventArgs e)
{
lnkLogin.PostBackUrl = Request.Url.AbsoluteUri;
}
受保护 void lnkLogin_Click( object sender,EventArgs e)
{
try
{
Server.Transfer( FrmLogin.aspx);
}
catch
{
}
}
}
解决方案
转到链接按钮的属性
并在支票事件中双击button_click事件
并检查它在哪里导航并在那里编写代码
使用它..
Server.Transfer( FrmLogin.aspx, true );
欲了解更多详情,请访问此处。
http://msdn.microsoft.com/en -us / library / 540y83hx(v = vs.100).aspx [ ^ ]
你能给我一个错误的简要说明吗?单击
链接按钮时会发出曲线。
例如尝试以下操作:
确保链接按钮被放置在
表格标签内,其中runat =server放置在表格标签中
ie。,
< 表格 名称 = xyz runat = server >
< asp:LinkButton ID = LinkButton1runat = server OnClick = LinkButton1_Click > 退出< / asp:LinkButton >
< / form >
Added a asp:LinkButton control to traverse to redirected page, but not working on onClick event.
Plz Help me out.
Code goes here...
<asp:LinkButton ID="lnkLogin" runat= "server" Text="[Login]"
Font-Underline="false" onclick="lnkLogin_Click" ></asp:LinkButton>
code behind page...
public partial class Home : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
lnkLogin.PostBackUrl = Request.Url.AbsoluteUri;
}
protected void lnkLogin_Click(object sender, EventArgs e)
{
try
{
Server.Transfer("FrmLogin.aspx");
}
catch
{
}
}
}
解决方案
Go to the property of link button
and in events of check double click on button_click event
and check where it is navigating you and write your code there
use this..
Server.Transfer("FrmLogin.aspx", true);
For more detail visit here.
http://msdn.microsoft.com/en-us/library/540y83hx(v=vs.100).aspx[^]
can you give me brief description of the error which occurred when clicking the
link button.
for instance try the following:
Make sure the link button is placed inside the
form tag with runat="server" placed in form tag
ie.,
<form name="xyz" runat="server"> <asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click">Logout</asp:LinkButton> </form>
这篇关于asp:LinkButton不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文