Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
heyy..
 
I use ajax jquery gridview to load a large amount of data..but the grid does not load..if less amount of data came the grid will display....otherwise it is not displayed...
 
So how to handle the large amount of data to display in ajax gridview...here is my code...
 
// showing bill details
    function ShowBillDetails(control)
    {
        $('#divGrid').html('');
        $('#divGrid').hide();
        $('#DisableDiv').show();
        var phoneNumber = $(control).attr('PhoneNumber').toString();
        showBillDialog();
        setTimeout(function() { ShowBills(phoneNumber) },3000);
    return false;
}
 
// for show the data in grid
function ShowBills(phoneNumber) {
    $.ajax({
        type: "POST",
        contentType: "application/json; charset=utf-8",
        url: "LinkingCustomers.aspx/GetBillData",
        data: "{'phoneNumber':'" + phoneNumber + "'}",
        dataType: "json",
        success: function(data) {
        var theHtml = data.d;
        $('#divGrid').show();
            $('#divGrid').html(theHtml)
            $('#DisableDiv').hide();
        } 
        ,
        error: function(result) {
            alert(result);
        }
    }); 
}
 
code.cs
---------
 #region WebMethods
 
        [WebMethod]
        public static string GetBillData(string phoneNumber)
        {  
                GridView gv = new GridView();
                System.IO.StringWriter stringWriter = new System.IO.StringWriter();
                HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter);
                DataTable objDT = new DataTable();
                objDT = LinkingCustManager.GetBillData(phoneNumber);
                //var result = from n in objDT.AsEnumerable().Take(5) select n;
                gv.CssClass = "gridtable";
                gv.DataSource = objDT;
                gv.DataBind();
                gv.RenderControl(htmlWriter);
                return stringWriter.ToString();
            
        }
        #endregion
Posted 22-Nov-13 19:00pm

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



Advertise | Privacy | Mobile
Web03 | 2.8.141015.1 | Last Updated 23 Nov 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100