How to use __doPostBack()

后端 未结 7 1369
离开以前
离开以前 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 05:17

    This is also a good way to get server-side controls to postback inside FancyBox and/or jQuery Dialog. For example, in FancyBox-div:

       
    
    

    JavaScript:

    function testMe(params) {
        var btnID= '<%=MyButton.ClientID %>';          
        __doPostBack(btnID, params);
    }
    

    Server-side Page_Load:

     string parameter = Request["__EVENTARGUMENT"];
     if (parameter == "param1")
         MyButton_Click(sender, e);
    

提交回复
热议问题