__doPostBack and hit function
I want my javascript to fire the postback event. I ha开发者_如何学编程ve put the javascript call in the onClientClick:
<asp:Button ID="submit_btn" runat="server"
OnClientClick="javascript:doSubmit();" Text="Update" Width="75px"
Height="26px" PostBackUrl="#" />
I am verifying some values and then submitting:
__doPostBack('submit_btn', '');
The problem is that the 'click event submit_btn_Click is not being hit. I thought this would be the case! Is this wrong?
Your <asp:Button>
will always generate a post-back event, and flow into your Page_OnLoad()
and other initialization events. You won't need to specifically call the JavaScript method __doPostBack()
.
精彩评论