I want to pass three parameters to a report services report in .net. I want to put the parameters in parameter object. Then set the parameter object to the report dynamically.
I do not want to use query string. I want use Server.Transfer("~/Reports/Rpt.aspx") and the access the parameter variable on the prior page and assign it to the report in the rpt.aspx page...
you need to do some basic research on HTML Forms and Post/Get commands this is the cornerstone for all web development. once you understand this, then you need to understand how asp.net mucks up this up with the page life cycle. then you can choose a solution which best meets your requirments.
right now it's like throwing darts in the dark hoping you land on the bulls eyes.
Also when requesting help, be sure to
1. clearly ask a question
2. include all the requirements and constraints
3. post your current code working or not
protected void Button1_Click(object sender, EventArgs e)
{
ParameterCollection PC = new ParameterCollection();
Parameter par = new Parameter();
par.Name = "zip_code";
par.DefaultValue = "11372";
PC.Add(par);
string returnUrl = "~/Reports/Rpt.aspx";
Response.Redirect(returnUrl);
Server.Transfer("~/Reports/Rpt.aspx");
}
here is my code... I want Rpt.aspx to pickup the PC variable on the other end. I thought this was a simple and common thing to do. If this approach is impossible I will try something else. This reusable page have several different user controls(list of reports) the user can pick from, each report will gathering various parameters. I thought if you could package all you arguments into on parameterCollection variable, you could just attach this variable to the corresponding report on the next page.
If the target is an asp.net page then you should be able to get it working using the advice given, but it'll take some doing in the page load event (where you'll have to build a query string to load it in hte report viewer anyway). If its' an SSRS report, pretty sure you've got to use the query string.
Hope this helps,
Alex
[small]----signature below----[/small]
Majority rule don't work in mental institutions
parameter collection only exists within this function. so the minute you exit the function the variable doesn't exist. The same is true if you move the variable to the class. it will loose scope once you transfer away from the object (redirect or transfer).
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.