[英]Why call __doPostback in an asp.net button?
I'm trying to figure out why someone would make a call to __doPostback() from an asp.net button. 我想弄清楚为什么有人会从asp.net按钮调用__doPostback()。 The button seem to postback automatically without having to make that call.
该按钮似乎自动回发而无需拨打该电话。
function getSelected() {
// set the value of some input field
__doPostback();
};
<asp:Button runat="server" Text="Select Orders" ID="btnSelected" OnClientClick="javascript:getSelected();">/asp:Button>
Because the function __doPostback
sets the event target and event arguments and this is required to correctly process the event on server side. 因为函数
__doPostback
设置了事件目标和事件参数,所以这是在服务器端正确处理事件所必需的。 Without calling it, you'll be able to generate a postback but your event handler on server side won't be called. 如果不调用它,您将能够生成回发,但不会调用服务器端的事件处理程序。
If you don't have any handler, there is no benefit on calling it. 如果您没有任何处理程序,则调用它没有任何好处。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.