M
MattB
I've got some controls (mostly textboxes for now) that get created at
runtime in a DataGrid. I create them using the OnItemDataBound event. I
realize this isn't ideal, but I'm trying to see if I can make this work
anyway.
In a button click event I loop through the dataset the datagrid is bound
to and try to use FindControl to get at my controls. Below is a snippet
from the button click event:
iRow = 0
For Each dr In dtGfields.Rows
strCol = dr("ColName")
theCell = dgGuest.Items(iRow).Cells(1)
Select Case strCol
...
Case Else
tb = theCell.Controls(0)
'dgGuest.FindControl(strCol)
If UCase(dr("val")) <> UCase(tb.Text) Then
xml = wwSales.EZTag(strCol, UCase(tb.Text))
End If
End Select
...
iRow += 1
Next
I've tried a bunch of different approaches with FindControl but I always
wind up with a return value of Nothing. Can anyone see anything here
that I'm doing wrong? I initially started out with using it like this:
tb = dgGuest.FindControl(strCol)
TIA!
Matt
runtime in a DataGrid. I create them using the OnItemDataBound event. I
realize this isn't ideal, but I'm trying to see if I can make this work
anyway.
In a button click event I loop through the dataset the datagrid is bound
to and try to use FindControl to get at my controls. Below is a snippet
from the button click event:
iRow = 0
For Each dr In dtGfields.Rows
strCol = dr("ColName")
theCell = dgGuest.Items(iRow).Cells(1)
Select Case strCol
...
Case Else
tb = theCell.Controls(0)
'dgGuest.FindControl(strCol)
If UCase(dr("val")) <> UCase(tb.Text) Then
xml = wwSales.EZTag(strCol, UCase(tb.Text))
End If
End Select
...
iRow += 1
Next
I've tried a bunch of different approaches with FindControl but I always
wind up with a return value of Nothing. Can anyone see anything here
that I'm doing wrong? I initially started out with using it like this:
tb = dgGuest.FindControl(strCol)
TIA!
Matt