2

I find myself having to create a Web Form page in my MVC3 application to host the ReportView control, for displaying rdlc reports for my users. I see quite an abundance of advice on how to go about this all, and it seems pretty simple.

What I would like to know is how do I get from a Razor based view to this report viewer page? Do I simply 'hard-code' a content url to the page, or is there some more polite way?

ProfK
  • 49,207
  • 121
  • 399
  • 775

2 Answers2

1

You can do this by adding route in global.asax file.

     routes.MapRoute(
         "ReportRoute",                         // Route name
         "Reports/{reportname}",                // URL
         "~/Reports/{reportname}.aspx"   // File
      );

Check out LeftyX solution with source code.

Community
  • 1
  • 1
jan salawa
  • 1,198
  • 1
  • 8
  • 25
0

You could use the Url.Content helper:

<a href="@Url.Content("~/report.aspx")">Show me the report</a>
Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
  • Thanks @Darin, that is what I meant with my 'hard-coded' url, hard in that it is an actual url, not an action. I'm starting to feel a bit more comfortable using the content helper inside an iframe, inside a regular controller managed view though. – ProfK Jul 26 '12 at 07:33
  • Well that's exactly what classic WenForms are: `actual urls` and not `actions`. So yo uhave to reference them as such. – Darin Dimitrov Jul 26 '12 at 07:34