Embedded in an asp:repeater a number of RadNumericTextBoxes and an equal number of required validators for the RadNumericTextBoxes are created:
On client side I have a jquery-setup checkbox change event handler that should toggle the value of all RadNumericTextBoxes between '' (empty) (when checked) or 0 (zero) (when un-checked):
So far so good; Values get changed the way I want.
However, when trying to submit the form the required field validators (rfv) fail even if the RadNumericTextBoxes displays 0 (zero).
How can I set the value of the RadNumericTextBoxes so that the required field validators don't fail?
<
asp:Repeater
runat
=
"server"
ID
=
"rep"
>
<
ItemTemplate
>
<
telerik:RadNumericTextBox
id
=
"txt"
NumberFormat-DecimalDigits
=
"0"
NumberFormat-GroupSeparator
=
""
runat
=
"server"
Type
=
"Number"
/>
<
asp:RequiredFieldValidator
runat
=
"server"
ID
=
"rfv"
ControlToValidate
=
"txt"
>*</
asp:RequiredFieldValidator
><
br
/>
</
asp:Repeater
>
On client side I have a jquery-setup checkbox change event handler that should toggle the value of all RadNumericTextBoxes between '' (empty) (when checked) or 0 (zero) (when un-checked):
$(document).ready(
function
() {
$(
"input[name$='chk']"
).change(
function
() {
chk_OnChange(
this
);
});
});
function
chk_OnChange(sender) {
if
(!sender.checked) {
$(
"input[name*='txt']"
).val(
'0'
);
}
else
{
$(
"input[name*='txt']"
).val(
''
);
}
}
So far so good; Values get changed the way I want.
However, when trying to submit the form the required field validators (rfv) fail even if the RadNumericTextBoxes displays 0 (zero).
How can I set the value of the RadNumericTextBoxes so that the required field validators don't fail?