How to use __doPostBack()

后端 未结 7 1377
离开以前
离开以前 2020-11-22 04:43

I\'m trying to create an asyncrhonous postback in ASP.NET using __doPostBack(), but I have no idea how to do it. I want to use vanilla JavaScript.

Some

7条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-22 04:59

    Old question, but I'd like to add something: when calling doPostBack() you can use the server handler method for the action.

    For an example:

    __doPostBack('<%= btn.UniqueID%>', 'my args');
    

    Will fire, on server:

    protected void btn_Click(object sender, EventArgs e)
    

    I didn't find a better way to get the argument, so I'm still using Request["__EVENTARGUMENT"].

提交回复
热议问题