M
MattB
This is just a rephrased version of a question I posted earlier. I think I'm
closer now, so it seemed worthy of a new (more specific) post.
In my repeater I'm dynamically creating text boxes, so at compile time I
don't know what text boxes are going to be present at run time. This is
where it seems the FindControl method would be come into play. I loop
through a list of control (all textboxes) names I created on page load and
see if they exist. Unfortunately, even though I see them on the page,
FindControl doesn't come back with anything. I'm guessing it's how I'm
implementing it. Here's some code:
For Each drfields In dtVFields.Rows
Dim strField As String = drfields.Item("Field")
Dim tb As Control = rptVerify.FindControl("txt" & strField)
If Not IsNothing(tb) Then
txtInput = tb.Text
End If
-----------------------
In my test scenario I know I created a textbox with an ID of txtbirth_date
inside the repeater rptVerify, but the code above returns nothing for tb. If
I load the page in a browser and view source, I see my textbox, and it's
id="rptVerify__ctl0_txtbirth_date". So the parent control name is in there,
the id I was expecting is in there, and some other stuff is in there. I
don't even know if that's really relevant. Anyone got any hints to make this
work? Thanks!
Matt
closer now, so it seemed worthy of a new (more specific) post.
In my repeater I'm dynamically creating text boxes, so at compile time I
don't know what text boxes are going to be present at run time. This is
where it seems the FindControl method would be come into play. I loop
through a list of control (all textboxes) names I created on page load and
see if they exist. Unfortunately, even though I see them on the page,
FindControl doesn't come back with anything. I'm guessing it's how I'm
implementing it. Here's some code:
For Each drfields In dtVFields.Rows
Dim strField As String = drfields.Item("Field")
Dim tb As Control = rptVerify.FindControl("txt" & strField)
If Not IsNothing(tb) Then
txtInput = tb.Text
End If
-----------------------
In my test scenario I know I created a textbox with an ID of txtbirth_date
inside the repeater rptVerify, but the code above returns nothing for tb. If
I load the page in a browser and view source, I see my textbox, and it's
id="rptVerify__ctl0_txtbirth_date". So the parent control name is in there,
the id I was expecting is in there, and some other stuff is in there. I
don't even know if that's really relevant. Anyone got any hints to make this
work? Thanks!
Matt