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

Validation Problem in Rad Numeric TextBox

4 Answers 260 Views
Input
This is a migrated thread and some comments may be shown as answers.
Akhil Raj
Top achievements
Rank 1
Akhil Raj asked on 01 Jun 2010, 06:55 AM
hi,
  In edit form template of gridview i used radnumerictextbox. I validate the value using requiredfiled validator. My initial value is 0 and i set in the required field validator. How can i handle empty text. When i delete values in textbox and press update the validator not captured the error and i got the old value before the textbox used.

How can i hablde this issue?

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 02 Jun 2010, 03:34 PM
Hello,

Try the following work-around and see whether it helps.

aspx:
 
  <FormTemplate> 
        <asp:Button ID="Button2" runat="server" Text="Update" CommandName="Update" /> 
        <telerik:RadNumericTextBox  ClientEvents-OnBlur="OnBlur" ID="tbUnitPrice" runat="server" Value="0" EmptyMessage="0"
        </telerik:RadNumericTextBox> 
 
        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="tbUnitPrice" 
            ErrorMessage="This field is required" InitialValue="0" runat="server" Display="Dynamic"
        </asp:RequiredFieldValidator> 


javascript:
 
    function OnBlur(sender, args) { 
        if (sender.get_value() == "") { 
            sender.set_value("0"); 
        }     
    } 
 


-Shinu.
0
Akhil Raj
Top achievements
Rank 1
answered on 03 Jun 2010, 12:43 PM
thanks friend... but i have a small issue regarding this method. when i delete the letters value reset to "0" correctly but the mouse is blinking...that feel ugly. any other method or any way to restrict that
0
navalkishore
Top achievements
Rank 1
answered on 06 Jan 2011, 06:17 PM
This doesn't seem to work if we have validation group involved.
0
Devinder
Top achievements
Rank 1
answered on 28 Mar 2011, 03:32 PM
Yes it is not supported with validation group
Tags
Input
Asked by
Akhil Raj
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Akhil Raj
Top achievements
Rank 1
navalkishore
Top achievements
Rank 1
Devinder
Top achievements
Rank 1
Share this question
or