jobs
2006-12-06 21:13:56 UTC
I have a dropdownlist that can't match up a NULL value to entry during
binding giving me this error:
has a SelectedValue which is invalid because it does not exist in the
list of items.
Parameter name: value
I know I can get around the issue by doing a union with a DBNULL in the
column before binding in the .net sqldatasource control. However, I
want to use that datasource for other controls and dont want it to have
a DBNULL value. So I thought the below code would work, since Ive read
that vb's NOthing is equal to DBNULL. Apparently it's not as the error
persist.
Protected Sub AddNull(ByVal sender As Object, ByVal e As
System.EventArgs)
sender.Items.Insert(0, New ListItem("None", Nothing))
End Sub
"None" is the text and does show up, but entries with DBNULL don't seem
to match to "Nothing"
Is there some code or value I can put in there that will tie to DBNULL,
or do I need to Cast DBNULL on the way out and on the way up?
binding giving me this error:
has a SelectedValue which is invalid because it does not exist in the
list of items.
Parameter name: value
I know I can get around the issue by doing a union with a DBNULL in the
column before binding in the .net sqldatasource control. However, I
want to use that datasource for other controls and dont want it to have
a DBNULL value. So I thought the below code would work, since Ive read
that vb's NOthing is equal to DBNULL. Apparently it's not as the error
persist.
Protected Sub AddNull(ByVal sender As Object, ByVal e As
System.EventArgs)
sender.Items.Insert(0, New ListItem("None", Nothing))
End Sub
"None" is the text and does show up, but entries with DBNULL don't seem
to match to "Nothing"
Is there some code or value I can put in there that will tie to DBNULL,
or do I need to Cast DBNULL on the way out and on the way up?