Click here to Skip to main content
15,178,422 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
In my project after saving the data into db it will show report (pdf ) in a new page.It working fine on all browsers expect IE .it will show System generated notification message (? symbol with Adobe reader (Header Text) .

private string CreateLE_ANEZ()
    {
        try
        {

            ReportDocument oRPT = new ReportDocument();
            oRPT.Load(System.Web.HttpContext.Current.Server.MapPath("Reports/LE-Einzel.rpt"));
            ReportDocument subreportArtikel = new ReportDocument();
            SubreportObject subreportObjectArtikel;
            subreportObjectArtikel = oRPT.ReportDefinition.ReportObjects["Subreport1"] as SubreportObject;
            subreportArtikel = subreportObjectArtikel.OpenSubreport("LE-Artikel-SubRepoert.rpt");
            CTemplate objTemp = new CTemplate();
            DataTable dtTemplate = objTemp.SelectLETemplate("ANEZ");
            oRPT.SetDataSource(dtTemplate);

            DataTable dtArtikelData = SelectLEArtikel();
            subreportArtikel.SetDataSource(dtArtikelData);
            #region set parameter values
            //AAddressen objCust = new AAddressen();
            //objCust=new CAddressen().SelectAddressen(AddressenID);
            CUsers objUser = new CUsers();
            objUser.UserID = UserID;
            AUsers objAUser = objUser.SelectUserProfile();
            CLand objLand = new CLand();
            objLand.ID = objAUser.Land;
            objLand.SelectLandById();
            objAUser.LandName = objLand.Lnd_Name;
            CUtilities objUtil=new CUtilities();                
            string strDate = LEDate.Day.ToString() + "." + LEDate.Month.ToString() + "." + LEDate.Year.ToString();
            string strLands = SelectLELand();

            /* Requirement No ::  18895       ::: Commented By Jyotheena Jose      :1/30/2014 11:21:17 AM
               string strSender = objAUser.Ort + " : " + strDate + " , " + " " + objAUser.FirmaName +  " " + objAUser.PLZ +" " + objAUser.Street + " , " + objAUser.FirstName + " " + objAUser.LastName;*/
            string strSender = objAUser.Ort + " : " + strDate + " , " + objAUser.FirmaName + ", " + objAUser.Street + ", " + objAUser.PLZ + " " + objAUser.Ort + " , " + objAUser.FirstName + " " + objAUser.LastName + " , " + objAUser.Position;
            string strLEDate = LEDate.ToString("yyyyMMdd") + "-";
            string strCum = "";
            string strNoCum = "";
            if (IsCumulation == "T")
                strCum = "X";
            else
                strNoCum ="X";

            switch (LENumber.Trim().Length)
            {
                case 1: strLEDate += "00" + LENumber;
                    break;
                case 2: strLEDate += "0" + LENumber;
                    break;
                default: strLEDate += LENumber;
                    break;
            }
            ParameterDiscreteValue pDescValue;
            ParameterFieldDefinitions pFielddDefs;
            ParameterFieldDefinition pFieldLoc = null;
            ParameterValues pValues = new ParameterValues();
            pFielddDefs = oRPT.DataDefinition.ParameterFields;
            pDescValue = new ParameterDiscreteValue();
            CreateParameterFields(pDescValue, pFielddDefs, pFieldLoc, pValues, "pLandList", strLands);
            CreateParameterFields(pDescValue, pFielddDefs, pFieldLoc, pValues, "pSender", strSender);
            CreateParameterFields(pDescValue, pFielddDefs, pFieldLoc, pValues, "pLEDate", strLEDate);
            CreateParameterFields(pDescValue, pFielddDefs, pFieldLoc, pValues, "pBemerkungen", Bemerk);
            CreateParameterFields(pDescValue, pFielddDefs, pFieldLoc, pValues, "pCum", strCum);
            CreateParameterFields(pDescValue, pFielddDefs, pFieldLoc, pValues, "pNoCum", strNoCum);
            CreateParameterFields(pDescValue, pFielddDefs, pFieldLoc, pValues, "pCumtext", Cumulation);
            #endregion

            string strFileName = "Pdf/" + UserID.ToString().Trim() + "Einzel.pdf";   

            if (!Directory.Exists(System.Web.HttpContext.Current.Server.MapPath("Pdf")))
                Directory.CreateDirectory(System.Web.HttpContext.Current.Server.MapPath("Pdf"));
            if (File.Exists(System.Web.HttpContext.Current.Server.MapPath(strFileName)))
                File.Delete(System.Web.HttpContext.Current.Server.MapPath(strFileName));
            oRPT.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, System.Web.HttpContext.Current.Server.MapPath(strFileName));
            return strFileName;
        }
        catch (Exception ex)
        {
            throw new Exception("CLE->CreateLE_ANEZ", ex);
        }
    }


After IN New page (ViewPdf1.aspx)
Protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["rpt"] == null)
                return;
            else
            {
                string strValues = Session["rpt"].ToString();
                string[] strData = strValues.Split(',');
                //Session.Remove("rpt");
                //ViewState["rpt"] = strData[1].Trim();
                //ViewState["LENo"] = strData[0].Trim();
                //string strUrl = ViewState["rpt"].ToString();
                string strUrl = strData[1].Trim();
                dvPdfLoader.InnerHtml = "<object data='" + strUrl + "' type='application/pdf'  width='100%' height='468px'></object>";
                string strQuery = Request.QueryString["s"];
                if (strQuery != null && CUtilities.Decrypt(strQuery.Trim()) == "mailsent")
                {
                    lblMessage.Text = "E-Mail erfolgreich gesendet";
                }
            }
        }
    }


I am Using IE 11 .

Regards
Jithesh A
Posted
Comments
   
You cannot rely on the ability of the client system to show PDF. That's why there is always a possibility to download the file. PDF is not a part of W3 standards.
—SA
jithesh a 2-Dec-14 3:19am
   
ok.but it showing in all other browser's except IE?
Kornfeld Eliyahu Peter 2-Dec-14 5:37am
   
Other browser had built in PDF viewer. IE relays on external application for that...

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

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900