把它的url写成javascript:yourFunction();

解决方案 »

  1.   

    HyperLink.NavigatorUrl = "javascript:alert('ok');return false"
      

  2.   

    HyperLink.NavigateUrl= "javascript:alert('ok');return false"
      

  3.   

    我是这样写:
    NavigateUrl='<%# String.Format("{0}?downFile={1}",Request.CurrentExecutionFilePath,DataBinder.Eval(Container.DataItem,"ID"))%>'
    可为什么会有这个错误:
    编译器错误信息: CS0117: “System.Web.UI.Control”并不包含对“DataItem”的定义
    怎样解决?请大侠救我
      

  4.   

    用<asp:Button
    不是很好吗
      

  5.   

    不是有一个asp:hyperlinkbutton 吗?
      

  6.   

    <asp:hyperlinkbutton id=hlbtn1 onClick=FunctionName runat=server/>void FunctionName()
    {
      Response.Write("Use me,please...");
    }
      

  7.   

    [C#]
    加一个隐藏按钮button1,button1的点击触发你写的 C#函数。
    private void button1_Click(object sender,System.EventArgs)
    {
      //调用C#函数
    }在Page_Load()事件里
    {
      HyperLink.NavigateUrl = Page.GetPostBackClientEvent(this.button1,"") + ";return false";
    }只是理论上的,具体要楼主实践了。