Reputation: 19
I am creating a web page that contains one Dropdownlist and Gridview.
Query is Dropdownlist will contains SQL Server database table list. When I select a table name from dropdownlist the Gridview needs to show entire table data and able to perform edit, update, delete, cancel
actions.
When I click edit
, Gridview need to show Update
and Cancel
buttons and it update should update dropdownlist table and also delete.
Please any one can help.
Thanks in advance.
Upvotes: 1
Views: 1930
Reputation:
You must hook in changing dropdoenlist and then update your grid
protected void YourDropDownList_SelectedIndexChanged(object sender, EventArgs e)
{
YouGridview.DataSource = YourdataSource;
YouGridview.DataBind();
}
Upvotes: 0
Reputation: 40990
You have to rebind your grid view on selected index changed of dropdown like this
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
gridview.DataSource = dataSource;
gridview.DataBind();
}
where datasource is your database query result
Upvotes: 1