0

Q:

I have a gridview contains a textbox as a template field :

the aspx:

 <asp:GridView Width="100%" ID="gv_Evaluation" CssClass="datatable" AllowSorting="True" runat="server" AutoGenerateColumns="False" AllowPaging="True" GridLines="None" OnRowDataBound="gv_Evaluation_RowDataBound"> <Columns> <asp:TemplateField HeaderText="serial"> <ItemTemplate> <asp:Label ID="lblSerial" runat="server"></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:BoundField HeaderText="activity type" DataField="activityType" /> <asp:BoundField HeaderText="weight" DataField="activityWeight" /> <asp:TemplateField HeaderText="evaluation"> <ItemTemplate> <telerik:RadTextBox ID="txt_evaluateWeights" runat="server" AutoPostBack="True" OnTextChanged="txt_evaluateWeights_TextChanged"></telerik:RadTextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txt_evaluateWeights" Display="Dynamic" ErrorMessage="*" SetFocusOnError="True"></asp:RequiredFieldValidator> </ItemTemplate> </asp:TemplateField> </Columns> <RowStyle VerticalAlign="Top" CssClass="row" /> </asp:GridView> 

the weight column contains the following numbers[50,10,10,10,5,5,10]

What I wanna to do is:

Validate the data entry when the user enters the data in the txt_evaluateWeights Where it must be less than or equal the meeting one in the weight column. I do that in server side. But I wanna to do that client side. I tried to use the compare validator but it doesn't suit my case because each time i compare with a different value, according to the weight column.

2
  • Is txt_evaluateWeights a numeric input? If so, I would maybe look into using the RadNumericTextBox instead, as I think it has some of the features you need built-in. Commented Aug 16, 2011 at 17:30
  • yeah it's but this not the problem now. I wanna to validate each entry according to the opposite one in the weight column. Commented Aug 17, 2011 at 7:59

1 Answer 1

2

You can use the CustomValidator class and set the ClientValidationFunction property to use clientside validation

see MSDN documentation

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.