I have two dropdownlists. The second is populated from the first ddl selection, hence the record selection is filtered via the first ddl to the second ddl.
I need to have Postback on the second to populate a third ddl. If I select the third item in the second ddl, the postback happens and this ddl goes back to the first record, and doesn't stay @ the third selected item.
I build this second ddl first in:
Page_Load
If (Not Page.IsPostBack).....
I also re-build this second ddl in:
Page_PreRender
Dim sqlGrp As String
sqlGrp = "SELECT GC+' - '+GD as Expr2, GC,GD, "
sqlGrp &= "DC FROM [RL-DG] WHERE "
sqlGrp &= "DC = " & " '" & ddlDivision.SelectedValue.ToString() & "'"
Dim cmdGrp As New OleDbCommand(sqlGrp, Con1)
Con1.Open()
Dim myRDR As OleDbDataReader = cmdGrp.ExecuteReader()
If myRDR.HasRows = True Then
ddlGroup2.DataSource = myRDR
ddlGroup2.DataTextField = "Expr2"
ddlGroup2.DataValueField = "GD"
ddlGroup2.DataBind()
End If
Con1.Close()
Any suggestion would be much appreciated!
Thanks!
I need to have Postback on the second to populate a third ddl. If I select the third item in the second ddl, the postback happens and this ddl goes back to the first record, and doesn't stay @ the third selected item.
I build this second ddl first in:
Page_Load
If (Not Page.IsPostBack).....
I also re-build this second ddl in:
Page_PreRender
Dim sqlGrp As String
sqlGrp = "SELECT GC+' - '+GD as Expr2, GC,GD, "
sqlGrp &= "DC FROM [RL-DG] WHERE "
sqlGrp &= "DC = " & " '" & ddlDivision.SelectedValue.ToString() & "'"
Dim cmdGrp As New OleDbCommand(sqlGrp, Con1)
Con1.Open()
Dim myRDR As OleDbDataReader = cmdGrp.ExecuteReader()
If myRDR.HasRows = True Then
ddlGroup2.DataSource = myRDR
ddlGroup2.DataTextField = "Expr2"
ddlGroup2.DataValueField = "GD"
ddlGroup2.DataBind()
End If
Con1.Close()
Any suggestion would be much appreciated!
Thanks!