How to Run Web Reports Designer?

Top  Previous  Next

 

For running the Web report designer it is necessary to put non visual StiWebDesigner component on the form and, in the event handler of a control, to call the Design() method:

 

<cc1:StiWebDesigner ID="StiWebDesigner1" runat="server" />

 

C#:
 

protected void Button1_Click(object sender, EventArgs e)

{

   StiWebDesigner1.Design();

}
VB.NET:
 
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)

   StiWebDesigner1.Design()

End Sub

 

For loading a report in the Web designer, the method of calling can be slightly modified:

 

C#:
 
protected void Button1_Click(object sender, EventArgs e)

{

   StiReport report = new StiReport();

   report.Load("D:\\SimpleList.mrt");

   StiWebDesigner1.Design(report);

}
 
VB.NET:
 
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)

   Dim report As StiReport = New StiReport()

   report.Load("D:\\SimpleList.mrt")

   StiWebDesigner1.Design(report)

End Sub

 

It requires a bit more complicated code to call the reports designer automatically when loading a page. It is necessary to exclude service messages which are sent by the client part of the designer to the server part:

 

C#:
 
protected void Page_Load(object sender, EventArgs e)

{

   if (Page != null)

   {

       string keyValue =
              Page.Request.QueryString.Get("stimulsoft_webdesigner");

     

       if (!IsPostBack && keyValue == null)

       {

           StiReport report = new StiReport();

           report.Load("D:\\SimpleList.mrt");

           StiWebDesigner1.Design(report);

       }

   }

}
 
VB.NET:
 
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

   If Not Page Is Nothing Then

       String keyValue =

              Page.Request.QueryString.Get("stimulsoft_webdesigner")

 

       If Not IsPostBack And keyValue Is Nothing Then

           Dim report As StiReport = New StiReport()

           report.Load("D:\\SimpleList.mrt")

           StiWebDesigner1.Design(report)

       End If

   End If

End Sub

 

 

Converted from CHM to HTML with chm2web Pro 2.85 (unicode)