Pages

Men

rh

7/08/2014

How to bind HTML Report with IFRAME Control in Asp.net with c#


I have stored the files in the Image folder of application directory.  For my requirement purpose, i have renamed HTML file to .htm.

Please find the code below.

 protected void DisplayReport(String strValue, Int32 intBCDE, Int32 intUserId)
        {
            try
            {
                String strNewfile = String.Empty;


                strFolderPath = Server.MapPath("~/Images/");


                strNewfile = "ReportName" + "_" + strValue.ToString() + "_" + intUserId + "_" + intBCDE + ".htm";


                string filepath = "https://" + BaseSiteUrl + "/Images/" + strNewfile;


                string RepotUrl = String.Empty;


                RepotUrl = new Uri(filepath).ToString();


                if (System.IO.File.Exists(strFolderPath + strNewfile.ToString()))
                {
                    ifrm1.Attributes["src"] = "";


                    ifrm1.Attributes["src"] = RepotUrl;


                    strValue = "";
                }
                else
                { }
            }
            catch (Exception ex)
            {
            }


        }




No comments :

Post a Comment