This is a migrated thread and some comments may be shown as answers.

RadToolBar, OnButtonClick, and RequiredFieldValidator

2 Answers 88 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Robert Eberhart
Top achievements
Rank 1
Robert Eberhart asked on 04 Jan 2013, 05:40 PM
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 Answers, 1 is accepted

Sort by
0
Robert Eberhart
Top achievements
Rank 1
answered on 04 Jan 2013, 05:49 PM
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


0
Kevin
Top achievements
Rank 2
answered on 05 Jan 2013, 03:45 PM
Hello Robert,

Another solution would be to set the ValidationGroup on your validator controls and the corresponding button that should cause validation.
Tags
ToolBar
Asked by
Robert Eberhart
Top achievements
Rank 1
Answers by
Robert Eberhart
Top achievements
Rank 1
Kevin
Top achievements
Rank 2
Share this question
or