Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I have three DropDownList Boxes on this Webform and when I click a button (reload the page) the first two boxes stay with the selected value but the third DDL box returns to the original index value of 0 as if the page has been loaded for the first time. All three sit within the "If.IsPostBack = False..." statement under the Page_Load Event. Does anyone know why the third DDL behaves this way?
If Page.IsPostBack = False Then
panel1.Visible = FalseDim myDataSet1 As DataSet = New DataSet
Dim myDataSet2 As DataSet = New DataSet
Dim myDataSet3 As DataSet = New DataSetDim SelectCommand1 As String = "Select * FROM Divisions"
Dim SelectCommand2 As String = "Select * FROM Customers"
Dim SelectCommand3 As String = "Select * FROM Services WHERE ServiceType = 'Blind'"Dim myConnection As OleDbConnection = New OleDbConnection(connStr)
Dim myDataAdapter1 As OleDbDataAdapter = New OleDbDataAdapter(SelectCommand1, myConnection)
Dim myDataAdapter2 As OleDbDataAdapter = New OleDbDataAdapter(SelectCommand2, myConnection)
Dim myDataAdapter3 As OleDbDataAdapter = New OleDbDataAdapter(SelectCommand3, myConnection)myDataAdapter1.Fill(myDataSet1, "Divisions")
myDataAdapter2.Fill(myDataSet2, "Customers")
myDataAdapter3.Fill(myDataSet3, "Services")ddDivisions.DataSource = myDataSet1
ddDivisions.DataMember = "Divisions"
ddDivisions.DataTextField = "DivisionNo"
ddDivisions.DataValueField = "Division"
ddDivisions.DataBind()ddlCustomers.DataSource = myDataSet2
ddlCustomers.DataMember = "Customers"
ddlCustomers.DataTextField = "CustomerName"
ddlCustomers.DataValueField = "CustomerID"
ddlCustomers.DataBind()ddlBlinds.DataSource = myDataSet3
ddlBlinds.DataMember = "Services"
ddlBlinds.DataTextField = "Cat2"
ddlBlinds.DataValueField = "ServiceType"
ddlBlinds.DataBind()End If

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |