Click to See Complete Forum and Search --> : Problems getting a DropDownList connect with a GridView


fuzion79
05-26-2006, 01:53 PM
Hey all,

I was wondering if someone could help me with a small problem that I'm experiencing. I'm trying to connect a DropDownList with a GridView. The DropDownList is connected to a database which lists states (ex: MA, TX, CA, etc.). The GridView is connected to a database which lists authors. What I want to is to get the attributes of an author(first name, last name, etc.) living in a particular state to automatically display in the GridView upon selecting a particular state in the DropDownList. Does anyone know how this could be accomplished? Any assistance would be greatly appreciated. :) Thanks!

handshakeit
05-29-2006, 12:06 AM
Fill grid view on selected index changed event of the dropdown list accoring to the selected value.

fuzion79
05-29-2006, 06:59 AM
what would that selected value be? here is the code...i'm not sure what to put after the equals sign:

Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Session("au_id") = ??????
If GridView1.Rows.Count > 0 Then
GridView1.Visible = True
End If
End Sub

handshakeit
05-29-2006, 08:24 AM
DropDownList1.SelectedValue.ToString().Trim()
use this value in your querry (in Where Clause)
and call your fill gridview method