How can you take a DropDownList selection to fill a GridView?

I would think this would be pretty easy but I am new a C# programming. I am using Visual Web Developer Express (great program at a great price) for C# and I simply want to make a selection in a DropDownList and have the detailed information (from the database) come up in a GridView or DetailView on the same page.

Any help would be much appreciated!! Thanks!



Answer this question

How can you take a DropDownList selection to fill a GridView?

  • mjschukas

    Actually, I just figured it out. This will do it:

    OnSelectedIndexChanged = DropDownList1_SelectedIndexChanged


  • R. Meyer

    Thanks for the replies Ice and Shakalama!

    Shakalama could you give me an example of the string you would use to retrieve the data to fill the datagrid

    Thanks!


  • onlywizkid

    hi,

    the best way that i know is to make your DDl autopostback and to use the value you recieve in your sql string to retrieve the data from the database and to fill the datagrid again

    hope this helps



  • Kal-EL_

    Hi,

    if you already have a datasource goto Data -> Show Data Sources the datasource window will come out. click the datatable that you want to display, drag it to your form, again click the datatable click the + sign to expand it, choose your ID field and change it to a combo box, then drag it your form. then start.

    hope this helps.

    goodluck



  • How can you take a DropDownList selection to fill a GridView?