P
pete
Hello all,
I'l displaying a dropdownlist inside a datagrid. The problem comes when I
try to get the values the user chose on postback.
If I rebind the datagrid, the values of the dropdownlist are all set back to
their original values. If I do not rebind the datagrid, I don't seem to have
access to the dropdownlist at all.
Code fragment:
For Each dgItem In Me.dgPlayerList.Items
strID = dgItem.Cells(0).Text
Dim ddlTeam As New DropDownList()
ddlTeam = dgItem.FindControl("ddlTeams")
strTeam = ddlTeam.SelectedItem.Value
I get the "Object reference not set to an instance of an object" on the last
line there when I do not rebind. I was under the impression that datagrids
had to be rebound on postback to access their contents, but I'm obviously
missing something. Hopefully something simple.
Thanks for any suggestions,
pete
I'l displaying a dropdownlist inside a datagrid. The problem comes when I
try to get the values the user chose on postback.
If I rebind the datagrid, the values of the dropdownlist are all set back to
their original values. If I do not rebind the datagrid, I don't seem to have
access to the dropdownlist at all.
Code fragment:
For Each dgItem In Me.dgPlayerList.Items
strID = dgItem.Cells(0).Text
Dim ddlTeam As New DropDownList()
ddlTeam = dgItem.FindControl("ddlTeams")
strTeam = ddlTeam.SelectedItem.Value
I get the "Object reference not set to an instance of an object" on the last
line there when I do not rebind. I was under the impression that datagrids
had to be rebound on postback to access their contents, but I'm obviously
missing something. Hopefully something simple.
Thanks for any suggestions,
pete