Click here to Skip to main content
15,906,816 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am creating a data table dynamically which has 10 rows and I am binding that table to Gridview.

In Gridview, I am having 4 dropdownlista, 5 textboxes and 1 label control.

I want to give clientside validations using javascript for textbox but I am unable to find the textbox control of a gridview using javascript.

I have searched google but I couldn't get the solution.

Please help.
Posted
Updated 9-Dec-10 21:31pm
v2
Comments
TweakBird 10-Dec-10 3:04am    
can you share sample code.?
Dalek Dave 10-Dec-10 3:31am    
Edited for Grammar and Syntax.

1 solution

Use datagrid's Itemdatabound or gridview's RowDatabound event to access controls at row level. Just bind the Javascript methods to the control at the time of databind and the validation events would automatically get triggered.

So you need is, add attributes to the textbox(or other controls), at there onchange/onblur call a JS method. Pass on the value of the control as a parameter too. Now, you have the value, do the validation needed and move ahead if needed.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900