Reputation: 11926
I have a value in an variable(MVC View). This value has to be passed to the stored procedure parameter.
The URL of Report hosted on Different box is:
http://differentbox/Reports/Pages/Report.aspx?ItemPath=%2fMyReports%2fReport1.
This reports needs a stored procedure, The value for the stored procedure should go from the MVC View.(The Value is available in a variable)
I want to Place a hyperlink on a MVC View, so that clicking on it will take the value from the MVC and stored procedure will run.
Any ideas please, I am looking for the approach of how to pass the value from VIEW to Stored Procedure.
Thank you
Upvotes: 0
Views: 1241
Reputation: 3942
Just add an action link with the parameter in the querystring. Otherwise use a reporting services webservice like suggested here: Executing Reporting Services Web Service from ASP.NET MVC Using WCF
Answer updated
Just add an <a href='blah'>
tag with the link pointing to your Reporting Services server.
To call a reporting services with a parameter use the SRSS R2 request as follow: http://differentbox/Reportserver?/MyReports/Report1&rs:Command=Render¶mname=value
Upvotes: 2
Reputation: 150313
Do async call with jquery, and send the parameter to your controller based on the view.
Save the variable in hidden field and then send it.
In the view:
var dataToSend = $("#(ID of the hidden with the value)").val();
$.ajax({
url: '@Url.Action(actionName, controllerName)',
type: "POST",
data: {data : dataToSend },
dataType: "json"
});
controller:
public void actionName(object data)
{
// Do what ever you want with the data.
}
Upvotes: 0