Using 2 dropdowns and 1 gridview

  • 13 years ago

    I want to use two dropdown lists on the same page but have the data go into one gridview when the user clicks on the dropdown list.  Is this possible?  This is the screen shot that I want to achieve.







    This is the gridview I want to use


    First Name

    Last Name



  • 13 years ago

    Yes, that's possible. Just reload the grid on the changed event of either of the drop down lists.


  • 13 years ago

    Thanks Joe for your response.  I'm a newbie and don't quite understand.  In the Dropdown1 and dropdown2 selected index change do I reload the grid like this...


    if dropdown1.selecteditem = dropdown1.selectedindex then

    gridview1.load  (don't know how to code this)

    end if

  • 13 years ago

    JJ, take a look through this series of articles:

    Although it talks about a "datagrid", most of it applies for a "gridview".


    to answer your question, yes, if you want the grid to load when the selected item in dropdown1 is equal to the selected index of dropdown2.

    However, the syntax would be more like:

    gridview1.DataSource = ???


    If you read through the articles mentioned, you'll soon pick it up. Its fairly strightforward once you have a go.


  • 13 years ago

    Excellent article Joe.  Thanks for your help!

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Better train people and risk they leave – than do nothing and risk they stay.” - Anonymous