I’m using ASP.NET to build a form which has 3 DropDownLists and one GridView.
i want that the first DDL to take it’s values from a DB using a sql query.
After i choose from the list, i want that the second ddl will display values from a DB using SQL query depends on what i have chosen in the first ddl and so on.
And every time i choose something from the DDL i want that the grid view will be updated correspondingly to the values i choose in the DDLs.
i used dataset to get value by query from the DB to the first DDL list (using object data source), but i have problems with updating the GridView by getting DataTable from stored procedure which get three values (from the DDLs).
Can someone help me please, or giving me a hint?
What you try to achieve is called Cascading drop down lists, and AJAX control toolkit has the required infrastructure for doing this (see here).
However, you also have other options:
AutoPostBackattribute of your DDLs totrueand double-click them, so that you get aSelectedIndexChangedevent handler for them, and in those handlers, fill other DDLs and update your GridView.