E
Elmo Watson
I previously had a project working, in which the Gridview was populated by a
DataSet - then, with a DropDownlist in one of the columns, using the
OnrowDataBound event, to populate the DDL with the correct item in the
returned data, I had :
myDDL.SelectedValue =
IIf(IsDBNull(MyDataSet.Rows(e.Row.RowIndex).Item("Fieldname")),
vbNullString, MyDataSet.Rows(e.Row.RowIndex).Item("Fieldname"))
In my new application, I'm using a DataView to populate the Gridview, since
there are filters which need to be used, dynamically - - I tried the same
kind of thing, but I'm not sure how it would work with a DataView:
Here's what I have that doesn't work:
..SelectedValue = IIf(IsDBNull(myDV.Item(e.Row.RowIndex).Item("Fieldname")),
vbNullString, myDV.Item(e.Row.RowIndex).Item("Fieldname"))
myDVis saved in cache, and retrieved when needed. However, I get the dreaded
"Object Reference not set to an instance of the object' error when it gets
to that line)
(and yes, this all between an "If e.Row.RowType = DataControlRowType.DataRow
Then" block
Any ideas on how to get that to work?
DataSet - then, with a DropDownlist in one of the columns, using the
OnrowDataBound event, to populate the DDL with the correct item in the
returned data, I had :
myDDL.SelectedValue =
IIf(IsDBNull(MyDataSet.Rows(e.Row.RowIndex).Item("Fieldname")),
vbNullString, MyDataSet.Rows(e.Row.RowIndex).Item("Fieldname"))
In my new application, I'm using a DataView to populate the Gridview, since
there are filters which need to be used, dynamically - - I tried the same
kind of thing, but I'm not sure how it would work with a DataView:
Here's what I have that doesn't work:
..SelectedValue = IIf(IsDBNull(myDV.Item(e.Row.RowIndex).Item("Fieldname")),
vbNullString, myDV.Item(e.Row.RowIndex).Item("Fieldname"))
myDVis saved in cache, and retrieved when needed. However, I get the dreaded
"Object Reference not set to an instance of the object' error when it gets
to that line)
(and yes, this all between an "If e.Row.RowType = DataControlRowType.DataRow
Then" block
Any ideas on how to get that to work?