RadToolBar, OnButtonClick, and RequiredFieldValidator

3 posts, 0 answers
  1. Robert Eberhart
    Robert Eberhart avatar
    2 posts
    Member since:
    Mar 2010

    Posted 04 Jan 2013 Link to this post

    Hello,

    I am having problems with the RadToolBar.  I created a page that utilized the RadToolBar and fires the ButtonClick event when the user clicks a RadToolBarButton.  When testing the page, clicking on the button would not cause the event to fire.  I removed all form elements except the RadToolBar and tested the page.  When you click on the RadToolBarButton, the event fires as it should.  I systematically began adding form elements into the form.  As soon as you add a RequiredFieldValidator control, the event no longer fires as it should.

    I have been having intermittent problems with the toolbar prior to this, but have the feeling that the problems I am having are interrelated.  Does anyone have an answer to why this problem is occurring with the validator and what a possible workaround is?  

    Thank you in advance for any assistance offered.

    - Robert Eberhart
  2. Robert Eberhart
    Robert Eberhart avatar
    2 posts
    Member since:
    Mar 2010

    Posted 04 Jan 2013 Link to this post

    I believe that I have answered my own question.

    I got to thinking that clicking on a RadToolBarButton is causing a postback which would cause the validator to fire and prevent the postback.  This theory was borne out by the following thread I found on StackOverFlow:
    RequiredFieldValidator + Button = Postback!

    I resolved the issue by adding CausesValidation="false" to the RadToolBarButton tag.  

    - Robert Eberhart


  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 05 Jan 2013 Link to this post

    Hello Robert,

    Another solution would be to set the ValidationGroup on your validator controls and the corresponding button that should cause validation.
Back to Top