M
MattB
I have a repeater control with text boxes in it that get built on the
fly based on values in web.config. Now I need to grab the text from those
boxes when the form is submitted. I can't just do something like testing to
see if the id is nothing, because that id isn't declared, so my app won't
compile.
So what I'm trying to do is reconstruct the IDs using the same method I
created them with (looping through a table) but that's coming up with empty
values. Is there a good trick for doing this? Is there a function to get a
list of all the text boxes on the page?
Here's a little bit of what doesn't work (the datatable dtVFields has
all the field names used to generate text boxes in the repeater):
Dim drfields As DataRow, bPassed As Boolean = False, txtInput As String,
txtDBValue As String
Dim tb As New TextBox
For Each drfields In dtVFields.Rows
Dim strField As String = drfields.Item("Field")
tb.ID = "txt" & strField
txtInput = tb.Text
'get the fields into the same string format for comparison
Select Case strField
Case "birth_date"
txtInput = Convert.ToDateTime(tb.Text).ToString
txtDBValue =
Convert.ToDateTime(dsGuest.Tables(1).Rows(0).Item(drfields.Item("Field"))).T
oString
-------------------------------------
It crashes on that line with the convert on it because tb.Text is always
nothing. Any suggestions? Thanks!
Matt
fly based on values in web.config. Now I need to grab the text from those
boxes when the form is submitted. I can't just do something like testing to
see if the id is nothing, because that id isn't declared, so my app won't
compile.
So what I'm trying to do is reconstruct the IDs using the same method I
created them with (looping through a table) but that's coming up with empty
values. Is there a good trick for doing this? Is there a function to get a
list of all the text boxes on the page?
Here's a little bit of what doesn't work (the datatable dtVFields has
all the field names used to generate text boxes in the repeater):
Dim drfields As DataRow, bPassed As Boolean = False, txtInput As String,
txtDBValue As String
Dim tb As New TextBox
For Each drfields In dtVFields.Rows
Dim strField As String = drfields.Item("Field")
tb.ID = "txt" & strField
txtInput = tb.Text
'get the fields into the same string format for comparison
Select Case strField
Case "birth_date"
txtInput = Convert.ToDateTime(tb.Text).ToString
txtDBValue =
Convert.ToDateTime(dsGuest.Tables(1).Rows(0).Item(drfields.Item("Field"))).T
oString
-------------------------------------
It crashes on that line with the convert on it because tb.Text is always
nothing. Any suggestions? Thanks!
Matt