Hello all

I am hoping someone can help me out with this problem.

I have a gridview control, I have 1 column where I add textboxes where the user can enter data (not the entire column, just a few selected cells). I do this using this code in the RowDataBound event:

If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.Cells(4).Text = "xxx" Then
' this indicates where a textbox should be placed to allow the user to enter an inv or check #
Dim txtbx As New TextBox
txtbx.Visible = True
txtbx.ID = "txtRow" & e.Row.RowIndex.ToString
txtbx.Width = Unit.Pixel(75)
txtbx.BackColor = Color.LightYellow
e.Row.Cells(4).Controls.Add(txtbx)
txtbx = Nothing
End If

The textboxes are added and I am able to interact with them just fine.

My problem is when I attempt to read the value of the textboxes, I can never find them in the gridview.

I have tried using .. something like
dim txtbox as textbox
for x=0 to gridview.rows.count - 1
txtbox=gridview.rows(x).findcontrol("txtBox" & x.tostring)
next

also tried..
dim txtbox as textbox
for x=0 to gridview.rows.count - 1
txtbox=gridview.rows(x).cells(0).controls.item(0)
next

also used TryCast which always returns nothing as well.

I also just tried using the full name that the gridview gave the textbox, by looking at the source in the browser I saw it had "gridview_ctl3_txtRow1"
So I tried to loop ALL controls in the ME object to find that textbox, again it was not found.

Is it unaccessible because I added it dynamically?

Here is what a record that has been given a textbox looks like in the rendered HTML (via view source)

<td>&nbsp;</td><td>(none selected)</td><td>&nbsp;</td><td align="right">$1,334.95</td><td align="center"><input name="grdExpList:_ctl3:txtRow1" type="text" id="grdExpList__ctl3_txtRow1" style="background-color:LightYellow;width:75px;" /></td>

The control is there, I just can't get to it.

This is a VS2008 asp.net VB project.

Anyone have any ideas? I figure I am missing something simple as most obvious solutions are come to last.

Thanks for any assistance you may lend.
Jon