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

Client Side validation On Edit RadGrid Row

2 Answers 313 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Prasad
Top achievements
Rank 1
Prasad asked on 25 Aug 2008, 10:51 PM
Hi,

I would like to know how to implement client side validation on controls in edit mode of any row. LIke on clicking edit button we get the edit template dispalyed. Now let us say i have a text box which should take input as integer, if the user enters any value other integet i should give a error message. And this validation should happen on the client side itself may on text changed or on last focus and when the user clicks update button it should not allow the user to submit. Any help would be appreciated./

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 26 Aug 2008, 04:56 AM
Hi Prasad,

I would suggest you to use a CustomValidator. You can place the CustomValidator in the EditItemTemplate and and you can perform the validation logic on the client side.

ASPX:
<EditItemTemplate> 
       <asp:TextBox id="TextBox1" runat="server" Text='<%# Bind("ContactName") %>'></asp:TextBox> 
       <asp:RequiredFieldValidator id="RequiredFieldValidator1" runat="server" ErrorMessage="*" 
        ControlToValidate"TextBox1"></asp:RequiredFieldValidator> 
     
 <asp:CustomValidator runat="server" id="CustomValidator1" 
        ControlToValidate="TextBox1" 
        ClientValidationFunction="CheckIntigers" 
        ErrorMessage="Invalid Input" /> 
 
 </EditItemTemplate> 


JS:
<script language="JavaScript"
  
    function CheckIntigers(sender, args) 
    { 
       
       
    } 
   
  </script> 


You can refer the following links to get more information regarding validation .
http://aspnet.4guysfromrolla.com/articles/073102-1.aspx
Validation

Thanks
Shinu.
0
Reena
Top achievements
Rank 1
answered on 25 May 2017, 06:52 AM

Hello Support Team,

I am using telerik Radgrid. In EditItemTemplate I have asp.net textboxes and for there validation I have asp:RequiredFieldValidator contols. these validation were working fine but I have need to use OnCommand client side event for edit case in my grid. When I implemented this event then validations are not working now by asp:RequiredFieldValidator as working before.its posting back to server code on OnItemCommand event without validating the fields.

 

I am sending my code example in attachment. Please provide my any solution.

 

 

Tags
Grid
Asked by
Prasad
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Reena
Top achievements
Rank 1
Share this question
or