web viewer form post stuck in a loop

Stimulsoft Reports.WEB discussion
Post Reply
gotaquestion
Posts: 15
Joined: Sat Jul 25, 2009 5:50 pm

web viewer form post stuck in a loop

Post by gotaquestion »

I have a report and inside the report I designed a form that collects two date parameters for the datasource.
When I run the report in the web viewer the form comes up fine.
But when I click the OK button the page refreshes again with the same form asking for the date parameters again. And it never shows the report. This cycle keeps repeating if I keep submitting the form with the OK button.
However, if I test the report in designer.exe the form shows up, I can choose my dates, click OK, and the report is generated no problem.

gotaquestion
Posts: 15
Joined: Sat Jul 25, 2009 5:50 pm

web viewer form post stuck in a loop

Post by gotaquestion »

here is the cs code just in case I'm doing something wrong:

protected void Page_Load(object sender, EventArgs e)
{

string ReportGuid = Request["rg"];

string ReportString = "";
Stimulsoft.Report.StiReport report = new Stimulsoft.Report.StiReport();

string sql = "select ReportXML from reports where ReportGuid = '" + ReportGuid + "'";
SqlConnection con = new SqlConnection(WebConfigurationManager.ConnectionStrings["ReportsConnectionString"].ConnectionString);

SqlCommand cmd = new SqlCommand();

cmd.Connection = con;
cmd.CommandText = sql;

using (con)
{
con.Open();
cmd.ExecuteNonQuery();
ReportString = cmd.ExecuteScalar().ToString();

}



report.LoadFromString(ReportString.ToString());
report.Render(true);
StiWebViewer1.Report = report;

}
Andrew
Posts: 4108
Joined: Fri Jun 09, 2006 3:58 am

web viewer form post stuck in a loop

Post by Andrew »

Hello,

Please, set the WebViewer to the cache mode:
StiWebViewer1.RenderMode = StiRenderMode.AjaxWithCache;
or
StiWebViewer1.RenderMode = StiRenderMode.UseCache;

Thank you.
gotaquestion
Posts: 15
Joined: Sat Jul 25, 2009 5:50 pm

web viewer form post stuck in a loop

Post by gotaquestion »

this fix works the first time through.
But I if I try to go to page 2 then the form comes back up.
Submitting the form then goes back to page 1.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

web viewer form post stuck in a loop

Post by Edward »

Hi

There problem arose because of the fact that there are 3 requirements for rendering reports with dialogues on the Web:

Here is requirements on using dialogues inside of Web page:

1) StiWebViewer.RederMode must be AjaxWithCache or UseCache.

2) Code of rendering report must be in any other place but not in PageLoad event of the WebPage. You can place this code for example inside the ButtonClick event.

3) Dialogues will work in web only when StartMode property in Dialogue Form is set in 'OnStart'

If these three requirements are satisfied, then your report will work with dialogues in Web environment.

So please remove code for loading of the report from PageLoad event to any other place of your form.

Thank you.

Post Reply