You must Sign In to post a response.
  • Category: ASP.Net MVC

    Sorting MVC Grid without post back.

    @Html.Grid(Model.LogViewModels).Named("ResultsGrid").Columns(c =>
    {
    c.Add(mod => mod.Log.SiteID).Titled("ID").SetWidth(100);
    c.Add(mod => mod.Log.ProcessDateFrom).Titled("Date From").SetWidth(100).Format("{0:MM/dd/yy HH:mm.ss}").SortInitialDirection(GridMvc.Sorting.GridSortDirection.Descending);
    c.Add(mod => mod.Log.InboundPayerID).Titled("Payer ID").SetWidth(200);
    c.Add(mod => mod.Log.OutboundPayerID).Titled("Outbound Payer ID").SetWidth(200);
    c.Add(mod => mod.Log.PayerName).Titled("Payer Name").SetWidth(200);
    });

    I want to sort the grid without post back
    using - jquery.tablesorter.min.js plugin & below JQuery. Sorting works but it takes one minute to sort.

    $(function(){
    $('table').addClass('tablesorter');

    $('table').tablesorter({
    widget: ['zebra'],
    sortList: [[0, 1]]
    });
    });
  • #768713
    This is the example code snippet for Gridview Paging and Sorting without postback
    <div>
    <asp:GridView ID="GvS" AllowSorting="True" Runat="server"
    EnableSortingAndPagingCallbacks="true" AllowPaging="true"
    AutoGenerateColumns="False" DataSourceID="SDb"
    PageSize="4">
    <Columns>
    <asp:BoundField DataField="SID" HeaderText="SID"
    SortExpression="SID" />
    <asp:BoundField DataField="SPName" HeaderText="SPName"
    SortExpression="SPName" />
    <asp:BoundField DataField="SaleCity" HeaderText="SCity" SortExpression="SaleCity" />
    <asp:BoundField DataField="SAmt" HeaderText="Samount"
    SortExpression="Samount" />
    </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SDb" runat="server"
    ConnectionString="<%$ ConnectionStrings:bhaskarConnectionString %>"
    SelectCommand="SELECT * FROM [S_Orders]"></asp:SqlDataSource>
    </div>


Sign In to post your comments