I am using doodle report which outputs quick reports in pds, html and xls formats. It is working fine as shown in the documentation link below:
http://doddlereport.codeplex.com/wikipage?title=Web%20Reporting
Now i need to be able to pass an ID value to the controller so report is generated dynamically.
the default route is as follows:
return routes.MapRoute("DoddleReport",
"{controller}/{action}.{extension}",
new { controller = defaultAction, action = defaultAction },
new { extension = new ReportRouteConstraint() }
which outputs the following url localhost/Report/ReadMeters.htm when using the following
actionlink @Html.ActionLink("HTM", "ReadMeters", new{ extension = "htm"})
I have tried to add a new route in global.asax that will accept an ID parameter as follows:
routes.MapRoute("DoddleReportExtension",
"{controller}/{action}.{extension}/id",
new { controller = "Report", action = "Index" },
new { extension = new ReportRouteConstraint(),
id = UrlParameter.Optional
}
);
and passing the value using actionlink:
@Html.ActionLink("View", "ReadMeters", new { id = ViewBag.ID, extension = "htm" }
but this is outputting url localhost/Report/ReadMeters.htm?id=19
this does not work and i get the following error:
Server Error in ‘/’ Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.Requested URL: /Report/ReadMeters.htm
Any Ideas how to fix this please? This is my first MVC project and so far have relied on the default routing mechanisms for other areas of the project but got stuck on this one.
Your help is appreciated, thanks
you could do something like this …
and then you can send the extension and the id to ActionResult..