- Home
- Forum
- ASP.NET MVC
- how to use parameter on reportviewer ASP.NET MVC 5
Starting in 2019, the Reporting control is no longer included in Essential Studio®. If you're experiencing issues with the Syncfusion� Reporting Platform, Report Viewer, Report Designer, or Report Writer, we recommend migrating to Bold Reports, our dedicated reporting platform.
Bold Reports offers a comprehensive suite of tools and features for all your reporting needs, and we will help you make a smooth transition from the discontinued control. Our support team at https://support.boldreports.com/ is here to assist you with any questions or difficulties you may encounter during the migration process.
We thank you for choosing Syncfusion� and appreciate your understanding.
Bold Reports offers a comprehensive suite of tools and features for all your reporting needs, and we will help you make a smooth transition from the discontinued control. Our support team at https://support.boldreports.com/ is here to assist you with any questions or difficulties you may encounter during the migration process.
We thank you for choosing Syncfusion� and appreciate your understanding.
how to use parameter on reportviewer ASP.NET MVC 5
Dears,
Greeting!
I have been working on Syncfusion Essential Studio Report Designer, I can be able to design .rdl reports and integrate with my MVC 5 application. but I am facing some difficulties, while using parameters. I have added the parameter I want on my report, the parameter is displayed on the report, but it is not working. would you please assist me on this
here is the screenshot of the report
Regards,
SIGN IN To post a reply.
7 Replies
DE
demis
June 23, 2016 08:05 AM UTC
sorry for the inconvenience. here is the link to the screenshot of the report
https://drive.google.com/file/d/0BzNtrMxL5QkteXE1c0tlaEhCdW8/view?pref=2&pli=1
YD
Yuvaraj Devarajan
Syncfusion Team
June 24, 2016 05:54 AM UTC
Hi Demis,
Thanks for contacting Syncfusion support.
The mentioned issue might have occurred due to some external CSS style overridden on the parameter block style of your application. We have prepared a sample with query parameter and it can be downloaded from the below location,
Sample: http://www.syncfusion.com/downloads/support/directtrac/general/ze/ReportSample1684534739.zip
Please refer to the below UG documentation link to create sample in ASP.MVC,
You can obtain the ASP.Net MVC ReportViewer samples from the below build installed location,
%userprofile%\AppData\Local\Syncfusion\EssentialStudio\version\MVC\reportsamples
Please share the below details to replicate the mentioned issue.
1) Share the referred CSS’s to check the parameter block style issue.
2) Provide us the used query parameter and parameter details.
3) Confirm your product version.
Regards,
Yuvaraj D.
DE
demis
June 24, 2016 10:50 AM UTC
Dear Yuvaraj D.
Thank you for your info!
I have seen all the resources that you have shared. what i faced is when i click View Report button, the result displaying is not actually based on the filter parameter data, it displays all the data,
Regards,
DE
demis
June 24, 2016 11:03 AM UTC
Here is additional information,
<Query>
<ElementPath>Root /S {@FullName, @StartDate ,@ActionType,@EndDate,@ActionReason}}
</ElementPath>
<XmlData>
<Root>
<S FullName="Abebe" StartDate="01-01-2016" ActionType="Hiring" EndDate="1" ActionReason="Vacant"/>
</Root>
</XmlData>
</Query>
Here is the code from the view side
@Html.AntiForgeryToken()
@(Html.EJ().ReportViewer("reportviewer").ProcessingMode(Syncfusion.JavaScript.ReportViewerEnums.ProcessingMode.Local).ReportPath("~/App_Data/HumanResource/EmpAction.rdl").ReportServiceUrl("/api/ReportAPI").DataSources(t => t.Name("DataSet1").Value(ViewData["DataSet1"]).Add()))
Here is the data from controller action
ViewData["DataSet1"] = employeeRep.GetEmpActionRep();
return View();
I have also attached the rdl file
Thank You!
Attachment: EmpAction_8932323d.zip
YD
Yuvaraj Devarajan
Syncfusion Team
June 27, 2016 08:50 AM UTC
Hi Demis,
We can achieve your requirement to override the View Report Click and doAjaxPost method in your CSHTML page to filter values based on parameter as shown in below code example.
JS:
|
ej.ReportViewer.prototype._viewReportParamsClick = function (event) {
var proxy = $('#reportsample').data('ejReportViewer');
var parameters = event.data.params;
var reportParams = proxy._getParameterJson(parameters);
proxy._refresh = true;
$('#' + proxy._id + '_viewBlockContainer .e-reportviewer-viewerblockcontent table:first').attr('isviewclick', 'true');
_params = reportParams;
proxy._refreshReport();
} |
WebAPI:
|
public void OnReportLoaded(ReportViewerOptions reportOption)
{
var parameters = new List<Syncfusion.Reports.EJ.ReportParameter>();
if (System.Web.HttpContext.Current.Items.Contains("parakey"))
{
parameters = new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize<List<Syncfusion.Reports.EJ.ReportParameter>>(System.Web.HttpContext.Current.Items["parakey"].ToString());
System.Web.HttpContext.Current.Items.Remove("parakey");
}
reportOption.ReportModel.Parameters = parameters;
if (parameters != null && parameters.Count > 0)
{
reportOption.ReportModel.DataSources.Clear();
reportOption.ReportModel.DataSources.Add(new ReportDataSource { Name = "StoreSales", Value = StoreSales.GetData(parameters[0].Values[0]) });
}
else
{
reportOption.ReportModel.DataSources.Clear();
reportOption.ReportModel.DataSources.Add(new ReportDataSource { Name = "StoreSales", Value = StoreSales.GetData("GA") });
}
} |
We have prepared the sample and it can be downloaded from below location,
Regards,
Yuvaraj D.
DE
demis
June 28, 2016 07:22 AM UTC
Dear Yuvaraj D.
Greeting!
Thank you for your quick replay, i think it will help me, but i am unable to download the file,
Regards,
YD
Yuvaraj Devarajan
Syncfusion Team
June 29, 2016 06:45 AM UTC
Hi Demis,
We are able to download the previously shared download link and the mentioned problem might have occurred due to slow network connection. So, please check your network connection. For your convenience, we have again uploaded the sample and it can be downloaded from the below location,
Regards,
Yuvaraj D.
SIGN IN To post a reply.
- 7 Replies
- 2 Participants
-
DE demis
- Jun 23, 2016 07:54 AM UTC
- Jun 29, 2016 06:45 AM UTC