I'm trying to fill a dropdownlist in a datagrid and I'm running into an error:
"Specified argument was out of the range of valid values. Parameter name: value "
When the value of the dropdownlist is 0.
Here's my aspx:
DataSource="<%# Load_States() %>"
SelectedValue='<%# Container.DataItem("State") %>'
here's my code-behind:
Public Function Load_States()
Dim cmdSelect As SqlCommand
Dim dtrStates As SqlDataReader
Dim strSelect AS string
Dim ddlDataSet as DataSet = New DataSet()
Dim conPubs As New SqlConnection(ConfigurationSettings.appSettings("sqlconnectionString"))
strSelect = "Select tblStates.* From tblStates"
Dim myDataAdapter as SqlDataAdapter = New SqlDataAdapter(strSelect, conPubs)
There's no value in the tblStates with a 0 so that's what's throwing the error. Any thoughts on how to get this work?