开发者

call javascript from control with ValidationGroup

How can I call a js function from the "onclientclick event" of a button if this button has a ValidationGroup set ??

<asp:开发者_JAVA技巧Button ID="btnTest" runat="server" Text="Test" OnClick="btnTest_Click"
                        ValidationGroup="ValidateMail" OnClientClick="javascript:return checkTest()" />

    <script>
    checkTest()
    {
      if(val)
       return true
     else return false
    }
    </script>


It looks like you are trying to validate something on your button click.

If you are, instead of doing the validation on the button click handler, I would add a validator and have it call your checkTest() function. Don't forget to add the validator to the "ValidateMail" validation group and set CausesValidation="true" on the button.

This will cause all of the validators in the ValidateMail validation group to fire.

Is this what you were after or did I miss the point of your question?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜