[resolved] How to exit the web designer when loaded from Page_PreRender

Stimulsoft Reports.WEB discussion
Post Reply
mvines
Posts: 35
Joined: Wed Aug 05, 2009 2:55 pm

[resolved] How to exit the web designer when loaded from Page_PreRender

Post by mvines »

I have a requirement to be able to optionally go straight into the report designer on page load loading a report template. I am accomplishing this right now with the following Page_PreRender event handler.

Code: Select all

protected void Page_PreRender(object sender, EventArgs e)
    {
        if (Session["AdHocReporting_ShowDesigner"] != null && (bool)Session["AdHocReporting_ShowDesigner"])
        {
            Session["AdHocReporting_ShowDesigner"] = false;
            ShowReportDesigner(); //code that loads my report into the designer.
        }
    }
Certainly not the cleanest thing in the world, but it works well enough. My issue is that once I load the web designer like this, I can't exit out of it. When I click exit, it just reloads the designer. I think the code to reload the designer is being called before my page lifecycle events (I know it is called before page load, but I still need to check if page_init is called.) So I haven't been able to really learn much about it so far.

So why doesn't the exit button actually exit the designer in this case? The same page works just fine when a button click instantiates and loads the designer. What can I do to get this execution path to function correctly?
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

[resolved] How to exit the web designer when loaded from Page_PreRender

Post by Edward »

Hi

Please try the following code:

Code: Select all

protected void Page_Load(object sender, EventArgs e)
{
string keyValue = Page.Request.QueryString.Get("stimulsoft_webdesigner");
if (!IsPostBack && keyValue == null)
{
StiReport report = new StiReport();
report.Load(HttpContext.Current.Server.MapPath(string.Empty) + "\\Reports\\myreport.mrt");
StiWebDesigner1.Design(report);
}
} 
Thank you.
mvines
Posts: 35
Joined: Wed Aug 05, 2009 2:55 pm

[resolved] How to exit the web designer when loaded from Page_PreRender

Post by mvines »

The code you provided does allow me to place the ShowReportDesigner code in my page load event handler instead of Page_PreRender. However, I am still unable to exit the report designer by clicking exit in the menu.
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

[resolved] How to exit the web designer when loaded from Page_PreRender

Post by Jan »

Hello,

Report designer redirects to page url which is used before running report designer. Report designer will be reloaded if your first page is page where report designer is placed and you load report designer in PageLoad event. We can add special property - ExitUrl to StiWebDesigner component. Property will be available in next builds.

Thank you.
mvines
Posts: 35
Joined: Wed Aug 05, 2009 2:55 pm

[resolved] How to exit the web designer when loaded from Page_PreRender

Post by mvines »

Thanks guys, this will make things much simpler.

Keep up the good work.
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

[resolved] How to exit the web designer when loaded from Page_PreRender

Post by Jan »

Hello,

Please contact us if you need any help.

Thank you.
Post Reply