View Single Post
  #1 (permalink)  
Old February 28th, 2006, 07:04 PM
rstelma rstelma is offline
Friend of Wrox
Points: 2,101, Level: 18
Points: 2,101, Level: 18 Points: 2,101, Level: 18 Points: 2,101, Level: 18
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2003
Location: , , .
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
Default Dynamic List Box Post Back Problem

Hi All,

 I have a page with three list boxes that are linked with Handles
 XXX.SelectedIndexChanged

 The boxes run very smoothly and quickly at first. But after I submit the query with the values from the list boxes with a button click event and the data is bound to the data grid the list boxes take forever to post back with the new values if I want to change their values.

 I've been thinking of trying a work around to actually post to another page for the results of the query but can you think of any reason why this is happening? Here is the code for the first list box. The other two are pretty much duplicates of this one.

Code:
      Sub getAreaID(ByVal FacID As Integer, ByVal RuleID As Integer)
          Dim SQL As String = "SELECT Areas.AreaID, Areas.AreaName FROM Areas
 INNER JOIN Facilities ON Areas.FacID = Facilities.FacID WHERE
 Facilities.FacID = " & FacID & "  ORDER BY Areas.AreaName ASC;"
          Dim oDA As New SqlDataAdapter(SQL, _oConn)
          Dim oDS As New DataSet
          oDA.Fill(oDS)
          ddlAreaID.DataSource = oDS
          ddlAreaID.DataTextField = "AreaName"
          ddlAreaID.DataValueField = "AreaID"
          ddlAreaID.DataBind()
          ddlAreaID.Items.Insert(0, New ListItem("All", 0))
          ddlSubID.Items.Insert(0, New ListItem("All", 0))
          ddlLocID.Items.Insert(0, New ListItem("All", 0))
          btnAdd.Visible = False
          grdInventory.Visible = False
      End Sub
 
      Private Sub ddlAreaID_SelectedIndexChanged(ByVal sender As Object, ByVal
 e As EventArgs) Handles ddlAreaID.SelectedIndexChanged
          If ddlAreaID.SelectedValue = 0 Then
              btnAdd.Visible = False
          End If
          ddlSubID.Items.Clear()
          ddlLocID.Items.Clear()
          getSubID(ddlAreaID.SelectedValue, _RuleID)
          grdInventory.Visible = False
      End Sub


Thanks,
Richard