CodeSmith Community
Your Code. Your Way. Faster!

Sorting EntityGridView when not using GetPaged Method

Latest post 02-07-2008 4:36 PM by rkralston. 1 replies.
  • 05-02-2007 1:23 PM

    • basolutions
    • Top 100 Contributor
    • Joined on 03-21-2007
    • Denver, CO
    • Posts 51
    • Points 1,175

    Sorting EntityGridView when not using GetPaged Method

    This has been a huge problem for me and from what I can tell, a lot of us.  Unless you are using the GetPaged method, the EntityGridView ignores the sorting event.  I started to throw out the NT grid, but then it dawned on me...

    1.  Setup your grid and datasource just as you usually would, except turn off sorting and paging on the datasource.

    2.  Add OnSorting="yourgrid_sorting" to your gridview

    3.  In the code behind, add your event handler:

            protected void yourgrid_Sorting(object sender, GridViewSortEventArgs e)
            {
                DataSource1.Sort = e.SortExpression + " " + (e.SortDirection == SortDirection.Ascending ? "ASC" : "DESC");
            }

     

    Your grid now sorts just like it was using the GetPage method!

    • Post Points: 60
  • 02-07-2008 4:36 PM In reply to

    Re: Sorting EntityGridView when not using GetPaged Method

    I am doing this, but it only sorts what is on the page.  I'm sure this is an issue with post backs & ajax, but I am not sure where to look.

    • Post Points: 5
Page 1 of 1 (2 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems