Niclas Pehrsson
Top achievements
Rank 1
Niclas Pehrsson
asked on 21 Apr 2010, 04:34 PM
I want to pass some arguments from the server to the Report for sub selecting of data. I have looked in this forums and found one thread were the suggestion were to do this but I can't get it to work. On the Client aside I do following.
And in the report:
Each method will run but Reportparameters is empty?? Am I doing something wrong?
public MainPage() |
{ |
InitializeComponent(); |
reportViewer1.RenderBegin += RenderBegin1; |
} |
private void RenderBegin1(object sender, RenderBeginEventArgs args) |
{ |
args.ParameterValues["StartDate"] = DateTime.Now; |
args.ParameterValues["Andra"] = "fff"; |
} |
And in the report:
private void NeedDataSource1(object sender, EventArgs e) |
{ |
var items = this.ReportParameters; |
var list = new List<Person>(); |
for (var i = 0; i < 100; i++) |
{ |
list.Add(new Person() {LastName = "Last1", FirstName = "First1"}); |
list.Add(new Person() { LastName = "Last2", FirstName = "First2" }); |
} |
this.DataSource = list; |
} |
12 Answers, 1 is accepted
0
Niclas Pehrsson
Top achievements
Rank 1
answered on 22 Apr 2010, 01:33 PM
I would really appreciate an answer on this, this is really crucial that this must work.
0
Niclas Pehrsson
Top achievements
Rank 1
answered on 22 Apr 2010, 02:13 PM
I think I may have solved it, it seems like I need to do this in the constructor
And hook in the event ItemDataBinding instead.
I would like more documentation on this.
I'm also looking for a more cleaner way to handle reports, I think it's kind of ugly to let the report file access the data layer directly. And even if it need to do it I would like to use dependency injection through the constructor or properties to be able to give the access to the report which its need.. for example be able to hook up an dependency injection framework in the wcf service.
this.ReportParameters.Add("StartDate", ReportParameterType.DateTime, null); |
And hook in the event ItemDataBinding instead.
I would like more documentation on this.
I'm also looking for a more cleaner way to handle reports, I think it's kind of ugly to let the report file access the data layer directly. And even if it need to do it I would like to use dependency injection through the constructor or properties to be able to give the access to the report which its need.. for example be able to hook up an dependency injection framework in the wcf service.
0
Amruta
Top achievements
Rank 1
answered on 29 Apr 2010, 01:18 PM
Hi,
Is there any way i can pass the values for Last Name and First Name from my xaml page? I need to display a list of items in the report. (like a list of all persons.) This list is generated using a business object at the client side. (it is shown in a grid in my SL application.) Now i want to generate a report for this.
Any help would be appreciated.
Regards,
Is there any way i can pass the values for Last Name and First Name from my xaml page? I need to display a list of items in the report. (like a list of all persons.) This list is generated using a business object at the client side. (it is shown in a grid in my SL application.) Now i want to generate a report for this.
Any help would be appreciated.
Regards,
0
Hi Amruta,
You can pass parameters from the client to the report server like Niclas has shown here. You can find more in depth explanation in the following blog post: Programmatic Initialization of Report Parameter Values in Telerik Reporting Silverlight Viewer.
Sincerely yours,
Steve
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items.
You can pass parameters from the client to the report server like Niclas has shown here. You can find more in depth explanation in the following blog post: Programmatic Initialization of Report Parameter Values in Telerik Reporting Silverlight Viewer.
Sincerely yours,
Steve
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items.
0
Amruta
Top achievements
Rank 1
answered on 05 May 2010, 06:40 AM
Hi Steve,
Thank you for your reply. I have already used this method to pass the parameters to the report. The only thing is i am not able to pass multiple values using multivalue attribute of the report parameter.
Now i need to concatenate different values using some separator and then i need to separate out the values in the report and create a list to bind to the report item. I am looking for some better approach.Can you please suggest some better solution?
Regards.
Thank you for your reply. I have already used this method to pass the parameters to the report. The only thing is i am not able to pass multiple values using multivalue attribute of the report parameter.
Now i need to concatenate different values using some separator and then i need to separate out the values in the report and create a list to bind to the report item. I am looking for some better approach.Can you please suggest some better solution?
Regards.
0
Hi Amruta,
What you're currently doing is the only way to go and there is no better alternative for the time being.
Regards,
Steve
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items.
What you're currently doing is the only way to go and there is no better alternative for the time being.
Regards,
Steve
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items.
0
raj
Top achievements
Rank 1
answered on 16 May 2011, 04:45 PM
Hi Amruta
Are u able to pass parameter from silverlight client to report viewer? If so please help me.. Thought following the methods.. I don seem to be getting... Can u help me? :( :( :(
Are u able to pass parameter from silverlight client to report viewer? If so please help me.. Thought following the methods.. I don seem to be getting... Can u help me? :( :( :(
0
Curtis
Top achievements
Rank 1
answered on 16 Jun 2011, 02:09 AM
Hi,
Can you please send me the complete steps/solution as how to query the report using parameters on silver light reportviewer using stored procedure or business objects.
Really appreciate your help.
Thanks,
Sri
Can you please send me the complete steps/solution as how to query the report using parameters on silver light reportviewer using stored procedure or business objects.
Really appreciate your help.
Thanks,
Sri
0
raj
Top achievements
Rank 1
answered on 16 Jun 2011, 06:02 AM
Hi sri
Even i had been searching for passing parameters in report viewer.Thought following many steps. I couldn't achieve it. But i have a roundabout solutions.Try passing your parameter using query string in the ReportServiceUri.. This works.
RAJ
Even i had been searching for passing parameters in report viewer.Thought following many steps. I couldn't achieve it. But i have a roundabout solutions.Try passing your parameter using query string in the ReportServiceUri.. This works.
RAJ
0
Amruta
Top achievements
Rank 1
answered on 16 Jun 2011, 06:30 AM
Hello,
sorry for the late reply as i was not accessing this account for few months.
i will share my approach of passing multiple parameters to reportviewer from xaml page.
I have added a separate page called Report.aspx to the web application project which is responsible to create a reportbook and attach the report document to it.
From Xaml page - I call this page on the click of "generate report" button.
I pass the parameters in the querystring as -
HtmlPage.Window.Navigate(new Uri("Report.aspx?Keyword=" + txtKeyword.Text + "&ObjectName=" + objectName + "&ObjectTypes=" + objTypeStr + "&Guid=" + guid + "", UriKind.Relative), "_blank");
here, ObjectTypes is the string of concatenated values from the list as i wanted to pass multiple values for this paremater. As per my previous posts to the telerik team, there was no other alternative but to pass multiple values concatenated in a single string and then seperate out the values in the report file using split function.
To acheive this,
i have written this code in the pade_load of Report.aspx -
Regards.
sorry for the late reply as i was not accessing this account for few months.
i will share my approach of passing multiple parameters to reportviewer from xaml page.
I have added a separate page called Report.aspx to the web application project which is responsible to create a reportbook and attach the report document to it.
From Xaml page - I call this page on the click of "generate report" button.
I pass the parameters in the querystring as -
HtmlPage.Window.Navigate(new Uri("Report.aspx?Keyword=" + txtKeyword.Text + "&ObjectName=" + objectName + "&ObjectTypes=" + objTypeStr + "&Guid=" + guid + "", UriKind.Relative), "_blank");
here, ObjectTypes is the string of concatenated values from the list as i wanted to pass multiple values for this paremater. As per my previous posts to the telerik team, there was no other alternative but to pass multiple values concatenated in a single string and then seperate out the values in the report file using split function.
To acheive this,
i have written this code in the pade_load of Report.aspx -
//Get the report parameters from the querystring.
string keyword = Server.UrlDecode(this.Request.QueryString["Keyword"]);
string objectName = Server.UrlDecode(this.Request.QueryString["ObjectName"]);
string objectTypes = Server.UrlDecode(this.Request.QueryString["ObjectTypes"]);
string guid = Server.UrlDecode(this.Request.QueryString["Guid"]);
//The multiple values are separated out from the string objectTypes and then have used these values to generate different reports.
string[] objectTypeArr = objectTypes.Split(new char[] { '.' });
I hope this post will help someone acheive similar task.
Regards.
0
Curtis
Top achievements
Rank 1
answered on 16 Jun 2011, 03:58 PM
Hi,
Thanks so much for the reponse. I was wondering if telerik has any kind of documentation for Q1 2011 release of reporting, for sending the parameters from silverlight.
Regards,
Sri
Thanks so much for the reponse. I was wondering if telerik has any kind of documentation for Q1 2011 release of reporting, for sending the parameters from silverlight.
Regards,
Sri
0
Amruta
Top achievements
Rank 1
answered on 17 Jun 2011, 06:20 AM
Passing multiple parameters to the report is quite a common scenario and i think there should be some better approach for acheiving this. I am not aware if telerik have included any new feature in the latest release.
regards.
regards.