Click here to Skip to main content
15,893,564 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
in my app, I use devexpress report designer which run in run time. what do i want is how save the template when i click a button because i used the following thee is no hope:
C#
protected void ASPxReportDesigner1_SaveReportLayout(object sender, SaveReportLayoutEventArgs e)
        {
            try
            {
                designArray = e.ReportLayout;
                MemoryStream ms = new MemoryStream();

                ReportViewer1.Report.LoadLayoutFromXml(new MemoryStream(e.ReportLayout));

                IEnumerable allCells = ReportViewer1.Report.AllControls<xrtablecell>();
                foreach (XRTableCell cell in allCells)
                    if (cell.Text.Length > 0)
                        if (cell.Text.StartsWith("tag#"))
                            cell.Tag = cell.Text.Replace("tag#", "");

                ReportViewer1.Report.SaveLayoutToXml(ms);
                ms.Position = 0;

                string result = new StreamReader(ms).ReadToEnd();

                string fullName = ReportViewer1.Report.GetType().FullName;
                if (fullName == "ReportsDLL._BaseReport.BaseReport")
                    fullName = "ReportsDLL." + ((BaseReport)ReportViewer1.Report).ReportModule + "." + ReportViewer1.Report.Name;

                string file = HttpUtility.HtmlEncode(System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath) + @"\Reporting\RepTemp\" + fullName + ".repx";

                if (File.Exists(file))
                    File.Delete(file);

                File.WriteAllText(file, result);
            }
            catch (Exception ex)
            {
                if (ex.InnerException != null)
                    Response.Write(ex.InnerException);
            }
        }
<pre lang="c#">

kindly, i want this asap
Posted

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