Hello all,
I do a submit by a ComboBox, AutoPostBack set to True, CausesValidation is set to True and the ValidationGroup is set
In this simple example is only validating the TextBox with a RequiredFieldValidator
And that works, ValidationSummary is showing the message.
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
</
telerik:RadScriptManager
>
<
telerik:RadComboBox
ID
=
"RadComboBox1"
runat
=
"server"
AutoPostBack
=
"True"
ValidationGroup
=
"item"
CausesValidation
=
"True"
>
<
Items
>
<
telerik:RadComboBoxItem
runat
=
"server"
Text
=
"RadComboBoxItem1"
Value
=
"RadComboBoxItem1"
/>
<
telerik:RadComboBoxItem
runat
=
"server"
Text
=
"RadComboBoxItem2"
Value
=
"RadComboBoxItem2"
/>
</
Items
>
</
telerik:RadComboBox
>
<
asp:TextBox
ID
=
"TextBox1"
runat
=
"server"
></
asp:TextBox
>
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator1"
runat
=
"server"
ControlToValidate
=
"TextBox1"
ErrorMessage
=
"RequiredFieldValidator"
ValidationGroup
=
"item"
></
asp:RequiredFieldValidator
>
<
asp:ValidationSummary
ID
=
"ValidationSummary1"
runat
=
"server"
ValidationGroup
=
"item"
/>
But the ComboBox is changing to the chosen index while the ValidationGroup is not valid.
How can I prevent the changing of the ComboBox when the ValidationGroup is not valid?
A solution could be to check if the form is valid, and if not then set the ComboBox to its previous value but I don’t know how to check the form and return a True or False, like the method it is done by a PostBack event?
Thanks,
Marco