开发者

How call many events function in javascript and call VB behind code sequentially by press asp.net button?

I request from the user fill some text box in(asp.net) about his info,then he/she press button for show his result, I make some javascript code to validate user input on evrey textbox. (all what I want >>> do not to show the result before verifying user data.) I make asp.net botton and call javascript event fun by OnClientClick and it is work . I request from the user fill some text box in(asp.net) about his info,then he/she press button for show his result, I make s开发者_StackOverflowome javascript code to validate user input on evrey textbox. (all what I want >>> do not to show the result before verifying user data.) I make asp.net botton and call javascript event fun by OnClientClick and it is work .

but How I can call VB behind fun code execute after javascript event fun and in the same button?? Please I realy need any one help me . Thanks

but How I can call VB behind fun code execute after javascript event fun and in the same button?? Please I realy need any one help me . Thanks


One thing that you can do is change your button to a standard HTML button that invokes a javascript and then set a style of display:none to your ASP.NET button.

You can perform your client side validation from the javascript executed by the HTML button and if validation passes then programmatically invoke the click event on the ASP.NET button.

This will ensure that your client validation will get executed first.

EDIT:

<script type="text/javascript">
  function clientValidations() {
    // If validation passes then submit
    if (checkText1() & checkText2() & getIndex() & checkText3()) {
      var aspButton = //Find ASP Button by clientID
      aspButton.click();
    }
  }
</script>

<!-- Define class 'hidden' as display:none -->
<input type="button" onclick="clientValidations();" value="Submit" />
<asp:Button ID="Button1" runat="server" UseSubmitBehavior="false" class="hidden" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜