0
我怎麼能執行從代碼後面單擊在C#此鏈接:由id = "link_chiudi"
元素從代碼中執行點擊後面
<a href="#close" title="Close" id="link_chiudi" class="close" runat="server"></a>
?
我怎麼能執行從代碼後面單擊在C#此鏈接:由id = "link_chiudi"
元素從代碼中執行點擊後面
<a href="#close" title="Close" id="link_chiudi" class="close" runat="server"></a>
?
通過添加onServerClick
:
<a href="#close" title="Close" id="link_chiudi" class="close" runat="server" onServerClick="link_chiudi_OnServerClick"></a>
protected void link_chiudi_OnServerClick(object sender, EventArgs e)
{
}
或者:
protected void Page_Load(object sender, EventArgs e)
{
link_chiudi.ServerClick += link_chiudi_ServerClick;
}
void link_chiudi_ServerClick(object sender, EventArgs e)
{
}
但我建議你使用LinkButton
,因爲它是一個ASP.Net服務器端控件:
<asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_OnClick">LinkButton</asp:LinkButton>
或者:
LinkButton1.Click += LinkButton1_Click;
爲什麼不使用'asp:HyperLink'? – Fred
你的技術是什麼?asp.net webform或asp.net mvc –