Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Everyone...........

In my program i am displaying the list of values in gridview like this........
C#
@{
   var grid = new WebGrid(source: Model.ElementAt(0).users, rowsPerPage: 20, 
   canPage: true, canSort: true,sortFieldName:"UserName",defaultSort: "UserName");
 }
<p>
  <div id="grid">
    @grid.GetHtml(
    tableStyle: "grid",
    headerStyle: "head",
    alternatingRowStyle: "alt",
    columns: grid.Columns(
    grid.Column("UserName","User Name",canSort:true),
    grid.Column("Email","Email",canSort:true),
    grid.Column("Date","Created Date",canSort:true),
    grid.Column("DeptID","Department ID",canSort:true),
    grid.Column(format: (item) => Html.ActionLink("Details", "Details", 
     new { id =   item.UserID     }))
   ))
     </div>
  </p>



now i want to sort the values in grid view..... how can i do this....... can anybody help me
Posted

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