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

autopostback and validator

2 Answers 122 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Josep Bonet
Top achievements
Rank 1
Josep Bonet asked on 10 Sep 2010, 02:27 PM
Hello,

I have an RadComboBox with autopostback set to "true". I've also a requiredvalidator on the RadComboBox. The Combo containes a "Select" element with a value "-1". When I switch from one item to the "Select" item, the validator fires and displays but the combo still makes a postback.

Sample:

<telerik:RadComboBox runat="server" ID="uxDepartment" Width="325px" AutoPostBack="true"
        CausesValidation="false" OnSelectedIndexChanged="uxDepartment_SelectedIndexChanged" />
<asp:RequiredFieldValidator runat="server" InitialValue="-1"
          ControlToValidate="uxDepartment" ErrorMessage="<%$ Resources:UI,inputRequired %>" />

Telerik version is 2010.2.826.35

Any idea?

Best regards

2 Answers, 1 is accepted

Sort by
0
Cori
Top achievements
Rank 2
answered on 10 Sep 2010, 02:29 PM
Hello Josep,

You have CausesValidation="false" on your RadComboBox, which excludes the control from being validated. Just remove that and the postback should be prevented by the validator.

I hope that helps.
0
Silvio Silva Junior
Top achievements
Rank 2
answered on 14 Dec 2013, 10:48 PM
Great!
Tags
ComboBox
Asked by
Josep Bonet
Top achievements
Rank 1
Answers by
Cori
Top achievements
Rank 2
Silvio Silva Junior
Top achievements
Rank 2
Share this question
or