【发布时间】:2011-05-02 16:41:07
【问题描述】:
using System;
namespace WebApplication1
{
public partial class _Default : System.Web.UI.Page
{
public void Download(object obj, EventArgs e)
{
Response.Write("abc");
}
protected void Page_Load(object sender, EventArgs e)
{
Literal1.Text = "<a id='anc' href ='#' runat='server' onserverclick='Download'>Click Me</a>";
Response.Write(Literal1.Text);
}
}
}
<div>
<asp:Literal ID="Literal1" runat="server"></asp:Literal>
</div>
我有上面的代码片段。我正在尝试通过以下方式将文字中的锚点绑定到函数:onserverclick = "Download"
但是事件没有触发。要求是锚点仅通过文字呈现。
请帮忙。
【问题讨论】: