Click here to Skip to main content
15,885,914 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have one webmethod in my aspx code behind page for getting employees daily report, i am binding that result into table through AJAX and JSON..

My problem is when i select single employee and get its data through AJAX it works properly , but when i select all employees (126) which gives me output of around 4000 records it gives me error of
x.support.cors.e.crossDomain.send

my ajax is :
java#
$.ajax({
   type: "POST",
   data: params,
   url: "../Sales/AdminDARReport.aspx/GetDARReport",
   contentType: "application/json; charset=utf-8",
   dataType: "json",
   success: function (res) {
      console.log(res.d);
      // alert(res.d.length);
   },error:function(res,msg,code){}
});


My webmethod is :
C#
[WebMethod]
public static List<DARReport> GetDARReport(string darfor, string employeeid, string fromdate, string todate)
{
   List<DARReport> dr = new List<DARReport>();
   try
   {
      SQLDataAccessHelper sq = new SQLDataAccessHelper();
      SqlParameter[] param = new SqlParameter[3];
      param[0]=new SqlParameter("@fromdate_o", SqlDbType.NVarChar);
      param[0].Value = fromdate;
      param[1] = new SqlParameter("@todate_o", SqlDbType.NVarChar);
      param[1].Value = todate;
      param[2] = new SqlParameter("@userid", SqlDbType.NVarChar);
      param[2].Value = employeeid;
      DataSet ds = new DataSet();
      if (darfor.ToLower() == "reagent")
      {
         ds = sq.ExecuteDataSet("usp_admin_reagent_report", param);
         if ((ds != null) && (ds.Tables.Count != 0) && (ds.Tables[0].Rows.Count != 0))
         {
            ds.Tables[0].TableName = "DARREAGENT";

            for (int i = 0; i < ds.Tables[0].Rows.Count - 1; i++)
            {
               dr.Add(new DARReport {
                  dardate =ds.Tables [0].Rows[i]["DARDATE"].ToString (),
                  placeofwork = ds.Tables[0].Rows[i]["PLACEOFWORK"].ToString(),
                  reagentcall = ds.Tables[0].Rows[i]["REAGENTCALL"].ToString(),
                  instrumentcall = ds.Tables[0].Rows[i]["INSTRUMENTCALL"].ToString(),
                  jointvisitwith = ds.Tables[0].Rows[i]["JOINTVISITWITH"].ToString(),
                  pobvalue = ds.Tables[0].Rows[i]["POB"].ToString(),
                  remarks= ds.Tables[0].Rows[i]["REMARKS"].ToString(),
                  employeename= ds.Tables[0].Rows[i]["USERNAME"].ToString()
               });
            }
            dr.Add(new DARReport {
               averagereagentcall = ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["AVERAGECALLS"].ToString(),
               averagepob = ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["AVERAGEPOB"].ToString()
             });
         }
      }
   }
   catch (Exception ex) { throw ex; }
   finally { }
   return dr;
}

i have just done alert for the number of records return but when the data is huge it doesnt gives alert for the count also...

please help me in this case..

Krunal
Posted
Updated 8-Nov-14 23:06pm
v2

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