Validating textbox in gridview

My code is: int sel Row Index = ((Grid View Row)(((Drop Down List )sender).

Check the id's of the Drop Down and Text Box(es) you want to validate and set them as variables in the javascript.

The Grid View looks something like this: If you carefully read the HTML code of the Grid View which I have posted above then you will notice one very special thing.

The "Description" and "Choose" columns are template columns.

Free counters Added on January 19,2012 Follow Me @vmsdurano A bit About Me Disclaimer The opinions expressed herein are my own personal opinions and does not represent the opinions of my employers.

Nor does it represent the opinion of my dog, because I don’t have one.

so that is why we need the 3rd value after the splitting of the ID.

I'm still really new to the whole thing, so I'm not sure what it is I've done here.

By default when the Grid View controls goes in edit mode, it displays Text Boxes for entering values.

You can not attach validation controls directly to these Text Boxes.

If you validate the Text Box onkeypress user will not be able to enter non numeric values.

You will be calling the above function on onkeypress event of the textbox like below.[code]//Other Gridview code......

Scott Mitchell March 2007 Summary: This is the Visual C# tutorial.

(Switch to the Visual Basic tutorial.) In this tutorial, we'll see how easy it is to add validation controls to the Edit Item Template and Insert Item Template of a data Web control, to provide a more foolproof user interface.

You must have an account to comment. Please register or login here!