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

OnValueChanging Triggers after OnError-RadnumericTextbox

3 Answers 108 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Atchut
Top achievements
Rank 1
Atchut asked on 25 Jul 2012, 08:56 PM
Hello,

I am using both onvaluechanging and onerror client side events of RadNumeric Textbox

If user enter non-numeric values, it is only executing onerror. If you user enter numeric value but which is invalid(lets say -10), I am handling that error but after that onvaluechanging is also executing. I dont want onvaluechaing triggers after error handler.

TIA

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 26 Jul 2012, 06:59 AM
Hi Atchut,

One suggestion is to assign a value to a variable whenever error occurs and check the condition inside the OnValueChanged event.

Javascript:
<script type="text/javascript">
    var error = 0;
    function OnError()
    {
        error = 1;
    }
    function OnValueChanged()
    {
        //if no errors occur
        if (error == 0)  
        {
           //your code
        }      
   }      
</script>

Thanks,
Shinu.
0
Atchut
Top achievements
Rank 1
answered on 26 Jul 2012, 10:43 PM
Hi..

mine is ValueChanging..It is not working...
0
Shinu
Top achievements
Rank 2
answered on 27 Jul 2012, 06:08 AM
Hi Atchut,

I same logic works  with the OnValueChanging event also.Here is the sample code I tried.

ASPX:
<telerik:RadNumericTextBox ID="TextBox1" runat="server" MinValue='0'>
  <ClientEvents OnError="OnError" OnValueChanging="OnValueChanging"/>
</telerik:RadNumericTextBox>

Javascript:
<script type="text/javascript">
    var error = 0;
    function OnError()
    {
        error = 1;
    }
    function OnValueChanging()
    {
        if (error == 0)  //will not enter into this loop if error occurs
        {
           //your code
        }     
   }     
</script>

Thanks,
Shinu.
Tags
Grid
Asked by
Atchut
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Atchut
Top achievements
Rank 1
Share this question
or