This is a migrated thread and some comments may be shown as answers.

Error in getting report parameter from Querystring

1 Answer 49 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
zydney
Top achievements
Rank 1
zydney asked on 17 Jul 2017, 04:50 AM

I am using HTML5 Web Form REST Telerik Reporting Q1 2017. When setup the first report which is using the wizard the report and parameter working properly.

However when I tried to pass the parameter from Querystring (from other web form) the report parameter becomes Null.

Please help me, What is the best workaround or solution for this issue?

=======================================================================

On the Page_Load report viewer I get the value from Querystring :

 protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                RptQuot1 report = new RptQuot1(Request.QueryString["Parameter1"] as string);
         
            }
        }

On the report constructor I added the parameter "Parameter1"

public RptQuot1(string parameter1)
        {                        
            InitializeComponent();
            this.DataSource = null;
            this.ReportParameters["Parameter1"].Value = parameter1;         
        }

Also on that class I added the NeedDataSource event handler :

public void RptQuot1_NeedDataSource(object sender, System.EventArgs e)
        { 

          Telerik.Reporting.Processing.Report report = (Telerik.Reporting.Processing.Report)sender;

          this.sqlDataSource1.Parameters[0].Value = report.Parameters["Parameter1"].Value;

          report.DataSource = this.sqlDataSource1;

        }

1 Answer, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 17 Jul 2017, 04:38 PM
Hello zydney,

As of Q3 2016, changes in events should be applied only on processing elements - Changes on items in report events are not applied.

Instead of the current code, please switch to using a ReportSource object to specify the report for the report viewer - How to migrate your project to utilize the new ReportSource objects.

The remove the NeedDataSource event, and configure the SqlDataSource component as in How to: Connect to a SQL Database(step6)


I hope this helps.

Regards,
Stef
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
zydney
Top achievements
Rank 1
Answers by
Stef
Telerik team
Share this question
or