Netnoobie
Well-known member
Hi all. I have a problem in that when editing a datagrid then clicking "update", I cant get the value from my DropDown. The error I see is: "Object reference not set to an instance of an object. "
this is what Im using to get the values for testing right now.
The error is on the "Dim sTemp as String = selTemp.SelectedItem.Value" line which makes me think that the DropDown isnt being referenced correctly. My page has EnableViewState=false to preserve everything. Ive tried to make that value true to get the data (and to actually get my Index to work properly upon editing the DataGrid) but I get all kinds of View State errors.
What am I doing wrong here? Ive been looking at this for some time now and cant figure it out.
Cheers!
this is what Im using to get the values for testing right now.
Code:
Dim selTemp As DropDownList = CType(e.Item.FindControl("selName"), DropDownList)
Dim sTemp as String = selTemp.SelectedItem.Value
lblMessage.Text = sTemp.ToString()
The error is on the "Dim sTemp as String = selTemp.SelectedItem.Value" line which makes me think that the DropDown isnt being referenced correctly. My page has EnableViewState=false to preserve everything. Ive tried to make that value true to get the data (and to actually get my Index to work properly upon editing the DataGrid) but I get all kinds of View State errors.
What am I doing wrong here? Ive been looking at this for some time now and cant figure it out.
Cheers!