Groups | Blog | Home
all groups > asp.net > july 2003 >

asp.net : Finding Grid controls


Rick Spiewak
7/24/2003 6:26:58 PM
I have been unable to find an elegant way to navigate to the controls in a
DataGrid in edit mode in order to get the changed values. I end up with a
lot of code like:

e.Item.Controls(5).Controls(0)

to get at a simple textbox, or:

e.Item.Controls(5).Controls(1)

if there is a multiline text box.

No ID's seem to end up on these controls, and I can't seem to find a
generalizable, clean way to access them. Any ideas?

Regards - Rick

abacnet NO[at]SPAM hotmail.com
7/24/2003 7:12:33 PM
I don't know if this is OK for you but I sometimes use template columns,
then I name the controls in design mode, and access them this way :

Dim txt as Textbox
txt=ctype(e.Item.fincontrols("txtName"), Textbox)

[quoted text, click to view]

AddThis Social Bookmark Button