How to Load GridView/Repeater Data On Scrolling the page/Paging in ASP.NET like Facebook

asp.netgridviewlazy-loadingscrollview

I have a GirdView which has more than thousands of records binded to it. I have applied the Paging for GirdView whenever we traverse the paging the request is sent again to Server and whole data is loaded into GridView from SQLServer DB, which I want to avoid Server Round Trip. Is it possible to Load Data First 100 Number of Records and then 101 to 200 and so on..Records when Scrolling the Grid or Paging from DataTable or DataSet?

Similar to Facebook loads Data on the Page only when the User Scrolls down the page. Is it possible to do in ASP.NET using C#?

Please Give me suggestion

Best Answer

Convert DataTable to json format :

    public static string DataTableToJSON(DataTable table)
    {
        List<Dictionary<string, object>> list = new List<Dictionary<string, object>>();

        foreach (DataRow row in table.Rows)
        {
            Dictionary<string, object> dict = new Dictionary<string, object>();

            foreach (DataColumn col in table.Columns)
            {
                dict[col.ColumnName] = row[col];
            }
            list.Add(dict);
        }
        JavaScriptSerializer serializer = new JavaScriptSerializer();
        return serializer.Serialize(list);
    }
Related Topic