J
jagdishl
Hi:
I have to basically populate another dropdown list based on the first
dropdown list.My first dropdown list contains only two values i.e
1.City
2.County
So the second dropdownlist should contain the values of either one of
those based on the selection.I have used the followind code in the
"Indexchanged" event of the first dropdown list.
Private Sub ddlprogtype_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ddlprogtype.SelectedIndexChanged
Connection.Open()
Dim X As String = ddlprogtype.SelectedValue
lbldisplay.Text = ddlprogtype.SelectedValue
Command.CommandText = "Select names from tblregions where type
= " + "@x"
DataReader = Command.ExecuteReader
ddlnames.DataSource = DataReader
ddlnames.DataBind()
Connection.Close()
End Sub
Upon compiling I am getting the following error message
Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object with error being pointed to the
following line
\Line 79: Command.CommandText = "Select places from tblRegions
where type = " + "@x"
Kindly advise on how I should tackle this error.Thanks
Jagdish.l
I have to basically populate another dropdown list based on the first
dropdown list.My first dropdown list contains only two values i.e
1.City
2.County
So the second dropdownlist should contain the values of either one of
those based on the selection.I have used the followind code in the
"Indexchanged" event of the first dropdown list.
Private Sub ddlprogtype_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ddlprogtype.SelectedIndexChanged
Connection.Open()
Dim X As String = ddlprogtype.SelectedValue
lbldisplay.Text = ddlprogtype.SelectedValue
Command.CommandText = "Select names from tblregions where type
= " + "@x"
DataReader = Command.ExecuteReader
ddlnames.DataSource = DataReader
ddlnames.DataBind()
Connection.Close()
End Sub
Upon compiling I am getting the following error message
Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object with error being pointed to the
following line
\Line 79: Command.CommandText = "Select places from tblRegions
where type = " + "@x"
Kindly advise on how I should tackle this error.Thanks
Jagdish.l