Asp.Net与C#背后的代码 [英] Asp.Net with the code behind C#
本文介绍了Asp.Net与C#背后的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用c#背后的代码开发一个ASP站点。我不明白如何为面板,超链接等asp控件编写用户定义的事件。
这是我的ASP代码..
I am developing an ASP site with the code behind c#. I can''t understand that how to write user-defined events for asp controls like panel, hyperlink and etc..
Here is My ASP Code..
<asp:HyperLink ID="signUp" runat="server" CssClass="row5">
<span>SIGNUP to </span>
<br />
<span>SEE</span>
</asp:HyperLink>
在上面的代码中,2 span'具有不同的样式,因此我无法将其删除..我想为此超链接编写click事件。我认为应该如下所示..
In the above code the 2 span''s have different style so that I cant remove it.. I want to write click event for this hyperlink. I thought that it should be like the following..
<asp:HyperLink ID="signUp" runat="server" CssClass="row5" onclick="signUp_click">
<span>SIGNUP to </span>
<br />
<span>SEE</span>
</asp:HyperLink>
背后的代码..
The code behind..
protected void signUp_click(object sender, EventArgs e)
{
panel1.Visible=true;
panel2.Visible=false;
signUp.Visible=false;
}
请帮我写asp控件的事件..
Please do help me to write event for asp controls..
推荐答案
没有针对HyperLink Control的点击事件。
如果你想要点击事件然后使用LinkButton。
No click event for HyperLink Control.
If you want a click event then use LinkButton.
你可以使用Hyperlink的NevigateUrl属性重定向到注册页面。
There is NevigateUrl property of Hyperlink you can use it to redirect to sign up page.
这篇关于Asp.Net与C#背后的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文