none
asp.net validators and IE9

    Pertanyaan

  • I have a webpart which contains a simple form with ASP.net validators, on the same page I have <button> elements acting simply as links using onclick="window.location = blah.aspx".  However, when I go to use one of these buttons, the validators on the webpart fire off. 

    • All of the webpart form controls, as well as their validators are in the same validation group.

    How do I prevent the <button>s on the page from invoking the validators for the webpart form?


    David Musselman

    11 Juli 2012 18:20

Semua Balasan

  • Hello!

    As I remember, asp:Button has the ValidationGroup property. You can set it to the value different from the validation group of other webpart form controls.

    So if all of the webpart form controls, as well as their validators are in the validation group 'Group1'. Set ValidationGroup="Group2" for the button acting as link.

    ps change onclick to something like this onclick="window.location = blah.aspx; return false;" in order to prevent useless postback.


    .Net Follower (http://dotnetfollower.com)


    11 Juli 2012 19:08