URL Parameters Value

Stimulsoft Reports.NET discussion
MLirko
Posts: 18
Joined: Mon May 30, 2022 12:50 pm

Re: URL Parameters Value

Post by MLirko »

Thanks again

I am trying to use the followinng code, but its not being passed through the the dashboard from server/dashboard/Default.aspx?vOrgID=something

protected void StiWebViewer1_GetReport(object sender, StiReportDataEventArgs e)
{
var report = StiReport.CreateNewDashboard();
var path = Server.MapPath("Reports/Report.mrt");
report.Load(path);

report.Dictionary.Variables["vOrgID"].ValueObject = Request.QueryString["vOrgID"];

e.Report = report;
}

The vOrgID variable is set as below
vOrgID_img.png
vOrgID_img.png (8.07 KiB) Viewed 1194 times
MLirko
Posts: 18
Joined: Mon May 30, 2022 12:50 pm

Re: URL Parameters Value

Post by MLirko »

Narrowing this down, hard-coding the variable like
report.Dictionary.Variables["vOrgID"].ValueObject = "moo"
also does not work


Oddly....I can trash the default.aspx.cs by filling it nonsense and the dashboard still loads?
MLirko
Posts: 18
Joined: Mon May 30, 2022 12:50 pm

Re: URL Parameters Value

Post by MLirko »

This is what I am working with if anyone can advise please?

Default.aspx

Code: Select all

<%@ Page Title="Report.mrt - Viewer" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication._Default" %>
<%@ Register assembly="Stimulsoft.Report.Web, Version=2022.2.5.0, Culture=neutral, PublicKeyToken=ebe6666cba19647a" namespace="Stimulsoft.Report.Web" tagprefix="cc1" %>

<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
	<cc1:StiWebViewer ID="StiWebViewer1" runat="server"
		OnGetReport="StiWebViewer1_GetReport">
	</cc1:StiWebViewer>
</asp:Content>
Default.aspx.cs

Code: Select all

using Stimulsoft.Report;
using Stimulsoft.Report.Dictionary;
using Stimulsoft.Report.Web;
using System;
using System.Data;
using System.IO;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
		
namespace WebApplication
{
	public partial class _Default : Page
	{
		static _Default()
		{
			Stimulsoft.Base.StiLicense.Key =
				"removed";
		
		}

		protected void Page_Load(object sender, EventArgs e)
		{
			StiReport report = new StiReport();
			report.Load(Server.MapPath("Reports/Report.mrt"));
			StiWebViewer1.Report = report;
		}

		protected void StiWebViewer1_GetReport(object sender, StiReportDataEventArgs e)
		{
			
			StiReport report = new StiReport();
			report.Load(Server.MapPath("Reports/Report.mrt"));
			
			report.Dictionary.Variables["vOrgID"].Value = "something";
			
			e.Report = report;

		}
	}
}
No matter what, the vOrgID does not change on the dashboard?
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: URL Parameters Value

Post by Lech Kulikowski »

Hello,

Do you check the provided sample?

Thank you.
Attachments
Screenshot 2022-06-01 225422.png
Screenshot 2022-06-01 225422.png (76.92 KiB) Viewed 1175 times
MLirko
Posts: 18
Joined: Mon May 30, 2022 12:50 pm

Re: URL Parameters Value

Post by MLirko »

Yes, I even tried simply changing the variable directly in the code

report.Dictionary.Variables["vOrgID"].ValueObject = "moo"

Have I set something up incorrectly on the variable in the mrt?
MLirko
Posts: 18
Joined: Mon May 30, 2022 12:50 pm

Re: URL Parameters Value

Post by MLirko »

Could the issue be IIS related?

Replacing the variable to request from user works
report.Dictionary.Variables["vOrgID"].RequestFromUser = true;
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: URL Parameters Value

Post by Lech Kulikowski »

Hello,

Please send us your project that reproduces the issue for analysis.

Thank you.
MLirko
Posts: 18
Joined: Mon May 30, 2022 12:50 pm

Re: URL Parameters Value

Post by MLirko »

Sorry for the late reply. Do you want the files attached here or send directly in PM?
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: URL Parameters Value

Post by Lech Kulikowski »

Hello,

You can attach it in the post or send it on support@stimulsoft.com

Thank you.
MLirko
Posts: 18
Joined: Mon May 30, 2022 12:50 pm

Re: URL Parameters Value

Post by MLirko »

Thanks again.

Here is the application
WebApplication.zip
(24.33 MiB) Downloaded 126 times
Post Reply