Click here to Skip to main content
15,894,907 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
can u please tell me how to put a to z filter option to my gridview.

thank you
Lakshman
Posted

Refer these links,i think it would be enough.

How To: Improve Column Sort Presentation for an ASP.NET GridView[^]

Gridview alphabetic sorting[^]

Regards :laugh:
 
Share this answer
 
C#
protected void grdTPAData_Sorting(object sender, GridViewSortEventArgs e)
        {
            if (ViewState["SORT_COLUMN"] != null)
            {


                if (e.SortExpression == ViewState["SORT_COLUMN"].ToString())
                {
                    if ((SortDirection)ViewState["SORT_ORDER"] == SortDirection.Descending)
                        ViewState["SORT_ORDER"] = SortDirection.Ascending;
                    else
                        ViewState["SORT_ORDER"] = SortDirection.Descending;
                }
                else
                    ViewState["SORT_ORDER"] = e.SortDirection;
            }
            else
                ViewState["SORT_ORDER"] = e.SortDirection;
            ViewState["SORT_COLUMN"] = e.SortExpression;
            GridDataBind();
        }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900