ASP.NET postback with jQuery?

前端 未结 6 1580
深忆病人
深忆病人 2020-12-13 21:19

I have a ASP.NET button but recently, I replaced it with a standard HTML button ... What I need to do is a postback to an ASP.NET page and ensure a method is called.

6条回答
  •  粉色の甜心
    2020-12-13 21:33

    See if this helps: http://www.codeproject.com/KB/aspnet/sample.aspx.

    Basically, you declare a dummy anchor tag:

     
    

    In your code behind, you need to declare a foo method:

    protected void foo(object sender, EventArgs e)
    {
        // Do something here
    }
    

    Then you can invoke this anchor's onclick function with this javascript:

    document.getElementById('anchorId').click()
    

提交回复
热议问题