I have a datagrid that has some controls (TextBoxes and DropDownLists)
that are created dynamically at runtime. I've got the generation working
ok, but now I need to see what was entered or selected in those controls
once the form is submitted.
I've tried using FindControl unsuccessfully like this:
cName = "first_name" 'this is the ID used when the control was created
Dim tb as TextBox
tb = FindControl(cName)
----------
So I thought maybe I needed to use the DataGrid's id (dgGuest) like this:
tb = dgGuest.FindControl(cName)
----------
But in both cases the value of tb = nothing, so the control was not found.
If I look at the source of the page when it's loaded in a browser, my
textbox's id looks like this:
id="dgGuest__ctl2_first_name"
Can someone tell me where I've gone wrong? Do I need to refer to the
cell it's in (like myCell.FindControl(cName))? That will be trickier but
for now I need to know what will work. Thanks!
Matt