I call this static web method in jquery and I populate the table with the help of jquery Data is successfully display in table . In web form page there is one drop-down and two date-picker (from date & to date) according to selection of these values data is display in table now I want to create crystal report when I click on export button then table data ,drop down value & date-picker value will be display in report
I store dt in session and call that want to call in crystal report and I add crystalreportviewer in crystal report
I have web static webmethod i.e
[WebMethod] public static string search_data(DateTime fromdate, DateTime todate, string region) { try { string result = ""; Ts1 td = new T1(); DateTime frDate = new DateTime(fromdate.Year, fromdate.Month, fromdate.Day, 0, 0, 0); DateTime to_Date = new DateTime(todate.Year, todate.Month, todate.Day, 23, 59, 59); List<griddataresult_Result> dq = td.griddataresult(frDate, to_Date, region).ToList(); DataTable dt = new DataTable(); dt.Columns.Add("ID", typeof(int)); dt.Columns.Add("OwnerName", typeof(string)); dt.Columns.Add("RegNo", typeof(string)); foreach (var c in dq) { dt.Rows.Add(c.ID, c.OwnerName, c.RegNo); } DataTable dtt= (DataTable)HttpContext.Current.Session["datagrid"]; result = DataSetToJSON(dt); return result; } catch (Exception) { throw new Exception(); } }
UPDATE
now i add this in webform
protectedvoidButton5_Click(object sender,EventArgs e){DataTable dt =Session["datagrid"]asDataTable;ReportDocument crystalReport =newReportDocument();//crystalReport.SetParameterValue("fromdate", fromdate);//crystalReport.SetParameterValue("todate", todate);//crystalReport.SetParameterValue("region", region);BindReport(crystalReport);ExportFormatType ft=ExportFormatType.NoFormat; ft =ExportFormatType.PortableDocFormat;}privatevoidBindReport(ReportDocument crystalReport){TrackDataEntities1 t=newTrackDataEntities1(); crystalReport.Load(Server.MapPath("data.rpt"));//griddataresult_Result dsc = t.griddataresult(fromdate,todate,region);//crystalReport.SetDataSource(dsc);CrystalReportViewer1.ReportSource= crystalReport;}
HTML
<asp:DropDownList ID="regiond" runat="server"AutoPostBack="True" onselectedindexchanged="regiond_SelectedIndexChanged"></asp:DropDownList><input ID="fromdate" value="dd/mm/yyyy" runat="server" clientidmode="static"/><input ID="todate" value="dd/mm/yyyy" runat="server" clientidmode="static"/>
this show nothing in report check this image
in this there is table data and drop-down and date values now i want to display this data in report
How can I display region, from date, to date value and table data in crystal report