protected void getpkeybt_Click(object sender, EventArgs e) { bool ch = checkFromToDate(); int i=checkTxt(); if ( ch == true && i==1) { try { Response.Buffer = false; Response.ClearContent(); Response.ClearHeaders(); ReportDocument rpt = new ReportDocument(); DateTime dt = DateTime.Parse(frmtxtdt.Text); DateTime dt1 = DateTime.Parse(frmtxtdt.Text); string frtxt = String.Format("{0:MM-dd-yyyy}", dt); string totxt = String.Format("{0:MM-dd-yyyy}", dt1); DataSet ds = Namespace.SP.EStoredprocedure(frtxt,totxt).GetDataSet(); if (!IsPageRefresh) { if (ds.Tables[0].Rows.Count > 0 && frtxt == ds.Tables[0].Rows[0]["Date"].ToString() && totxt == ds.Tables[0].Rows[0]["Date"].ToString()) { ds.Tables[0].TableName = "Passkeys"; ds.WriteXml(Server.MapPath("~/XML/Passkeys.xml")); string filename = Server.MapPath("~/Upload/Pkey_rpt.rpt"); rpt.Load(filename); rpt.SetDataSource(ds); rpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "Passkeys"); } else if(frmtxtdt.Text.Trim() !=null && totxtdt.Text.Trim()!=null) { if (frtxt == ds.Tables[0].Rows[0]["Date"].ToString() && totxt == ds.Tables[0].Rows[0]["Date"].ToString() && ds.Tables[0].Rows.Count == 0) { lblmsg.Text = "Pass Key Not Yet Delivered for the Selected Date..."; } else { lblmsg.Text = "There is No Schedule for the Selected date...."; } } } } catch (Exception ex) { lblmsg.Text = ex.Message; } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)