In my project i am using gridview and i want gridview data to sort based on dropdown
selection item. how to achieve this?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Princy GuptaPosted Apr 4, 2014, 7:13 AM
check if the following links helps you
http://forums.asp.net/t/1784918.aspx?Sort+Gridview+Data+Based+On+Selection+Value+from+Dropdown+List+
http://www.codeproject.com/Questions/427866/Sorting-using-Dropdownlist-with-Gridview
All the best
samantaPosted Mar 18, 2014, 12:27 AM
Lakshmanan Sethu SankaranarayanPosted Mar 17, 2014, 7:20 AM
samantaPosted Mar 17, 2014, 6:35 AM
DataTable must be set prior to using DataView.
samantaPosted Mar 17, 2014, 6:35 AM
DataTable must be set prior to using DataView.
Lakshmanan Sethu SankaranarayanPosted Mar 17, 2014, 6:16 AM
samantaPosted Mar 17, 2014, 6:11 AM
Lakshmanan Sethu SankaranarayanPosted Mar 17, 2014, 6:07 AM
samantaPosted Mar 17, 2014, 5:42 AM
Lakshmanan Sethu SankaranarayanPosted Mar 17, 2014, 5:37 AM
samantaPosted Mar 17, 2014, 5:02 AM
Lakshmanan Sethu SankaranarayanPosted Mar 17, 2014, 4:42 AM
Please try this method in index changed of your second dropdown.
DataView dvItems = new DataView((DataTable)ds.Tables["datatable1"]);
if (ddl_itemsorderby.SelectedValue == "Ascending")
dvItems.Sort = "Menu_Group, Item_Name ASC";
else
dvItems.Sort = "Menu_Group, Item_Name DESC";
gridview1.DataSource = dvItems;
gridview1.DataBind();
samantaPosted Mar 17, 2014, 4:27 AM
Lakshmanan Sethu SankaranarayanPosted Mar 17, 2014, 4:16 AM
samantaPosted Mar 17, 2014, 3:12 AM
i have two DropDownList in that first DropDownList1 contains some items and DropDownList2 contains ascending and descending options. based on this gridview data must be sort.
Nilesh AvhadPosted Mar 17, 2014, 2:58 AM
please refer the following link.
http://www.codeproject.com/Questions/456134/How-to-display-data-in-a-gridview-which-selected-b
Please mark as answer if it solves your problem.
Regards,
Nilesh