Hello everybody,
I had two RadNumericTextBox TextInicio & TextFin (initial text and final text).
The rule here is:
The value in TextInicio can not be bigger than TextFin and viceversa.
So I created a function to check values entered by the user. If one of these values break this rule then it will be necesary to change its value to correct this situation.
The thing is that set_value() is not working; the value remains unset.
I also debugged it with Firefox Developer Tools.
NOTE: Min and Max values are set on server side at page´s Load method. But they usually goes from 1 to 2000.
Are there any others factors I have to take under consideration?
Any ideas about what could be the cause of this??
Am I doing something wrong? If you need something else please let me know.
Here is the code in my page.
01.
...
02.
03.
<script type=
"text/javascript"
id=
"telerikClientEvents1"
>
04.
//<![CDATA[
05.
06.
function
checkValues(sender, args, isInitial) {
07.
var
txtIni = $find(
"<%=TextInicio.ClientID%>"
);
08.
var
ini = txtIni.get_value();
09.
10.
var
txtFin = $find(
"<%=TextFin.ClientID%>"
);
11.
var
fin = txtFin.get_value();
12.
13.
if
(ini > fin)
// if initial is bigger than final then it is necesary to adjust a value
14.
{
15.
if
(isInitial)
// which value will be set
16.
{
17.
txtIni.set_value(fin);
18.
}
19.
else
20.
{
21.
txtFin.set_value(ini);
22.
}
23.
}
24.
25.
}
// END of checkValues function
26.
27.
//]]>
28.
</script>
29.
30.
...
01.
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
Runat
=
"server"
EnablePageMethods
=
"True"
>
02.
</
telerik:RadScriptManager
>
03.
<
telerik:RadWindowManager
ID
=
"RadWindowManager1"
runat
=
"server"
ResolvedRenderMode
=
"Classic"
>
04.
</
telerik:RadWindowManager
>
05.
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
06.
</
telerik:RadAjaxManager
>
07.
...
08.
<
telerik:RadNumericTextBox
ID
=
"TextInicio"
runat
=
"server"
Value
=
"0"
DataType
=
"System.Int32"
MinValue
=
"1"
>
09.
<
NumberFormat
ZeroPattern
=
"n"
DecimalDigits
=
"0"
></
NumberFormat
>
10.
<
ClientEvents
OnValueChanged
=
"function(sender, args){checkValues(sender, args, true);}"
/>
11.
</
telerik:RadNumericTextBox
>
12.
...
13.
14.
<
telerik:RadNumericTextBox
ID
=
"TextFin"
runat
=
"server"
Value
=
"0"
DataType
=
"System.Int32"
MinValue
=
"1"
>
15.
<
NumberFormat
ZeroPattern
=
"n"
DecimalDigits
=
"0"
></
NumberFormat
>
16.
<
ClientEvents
OnValueChanged
=
"function(sender, args){checkValues(sender, args, false);}"
/>
17.
</
telerik:RadNumericTextBox
>
18.
...