This is a migrated thread and some comments may be shown as answers.

how to use telerik reportviewer in mvc 2.0

7 Answers 293 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Azeheruddin khan
Top achievements
Rank 1
Azeheruddin khan asked on 28 Jul 2010, 03:05 PM
Dear all,

I am using mvc 2.0 and i want to use telerik reortviewer to display telerik report.is it possible. I want some sample for that.

best rgds
Azeheruddin khan

7 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 29 Jul 2010, 09:26 AM
Hello Azeheruddin khan,

This has been elaborated in the Using Telerik Web ReportViewer in ASP.NET MVC application code library.

All the best,
Peter
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
Azeheruddin khan
Top achievements
Rank 1
answered on 29 Jul 2010, 01:25 PM
hi peter,

Thanx for sending these samples. For starting purpose it is good stuff. I followed same step as in sample but not getting.Could plzs help.
I am using mvc web user control and telerik left panel bar and reportviewer.I am putting my code...

this is my controller

 [Authorize]
        public ActionResult Index()
        {
            ViewData["TopMenu"] = Utils.GetUser(HttpContext).TopMenus;
            ViewData["LeftMenu"] = Utils.GetLeftMenu(HttpContext, "School");

            return View();
        }

this is my view

<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<SAMA.DataModels.Common.User>" %>

<%@ Register Assembly="Telerik.ReportViewer.WebForms, Version=4.0.10.423, Culture=neutral, PublicKeyToken=a9d7983dfcc261be"
    Namespace="Telerik.ReportViewer.WebForms" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <%//= Html.Telerik().StyleSheetRegistrar()
        // .DefaultGroup(group => group
        // .Add("telerik.common.css")
        //.Add("telerik.vista.css")
        // .Combined(true)
        //  .Compress(true)
        //          )
    %>
    User
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="TopMenu" runat="server">
    <% Html.RenderPartial("TopNavigation", ViewData["TopMenu"]); %>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="LeftMenu" runat="server">
    <% Html.RenderPartial("LeftNavigation", ViewData["LeftMenu"]); %>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="MainContent" runat="server">
    <script runat="server">
        
        public override void VerifyRenderingInServerForm(Control control)
        {
            // to avoid the server form (<form runat="server">) requirement
        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // bind the report viewer
            ReportViewer1.Report = new SAMA.Reports.Report1();
        }
    </script>
    <telerik:ReportViewer ID="ReportViewer1" runat="server">
    </telerik:ReportViewer>
    <%= Html.Telerik().ScriptRegistrar() %>
</asp:Content>

best rgds.
Azeheruddin khan

0
David
Top achievements
Rank 1
answered on 27 Aug 2010, 02:21 AM
I followed the example in this link (and received help from tech support to make my reports render on RackSpace cloud sites), but I am now stuck on this error when I try to export to excel + similar error when exporting to pdf.

Also doesn't print with proper formatting??? 

Any help would be appreciated - I am out of ideas/places to look for answers on my own.


Server Error in '/' Application.

Security Exception

Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
   System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
   System.Security.CodeAccessPermission.Demand() +58
   System.Drawing.Font.ToLogFont(Object logFont, Graphics graphics) +70
   System.Drawing.Font.ToLogFont(Object logFont) +95
   Telerik.Reporting.Excel97.Font.GetData() +328
   Telerik.Reporting.Excel97.Workbook..cctor() +123
0
Steve
Telerik team
answered on 27 Aug 2010, 12:04 PM
Hello David,

This is expected behavior when running in Medium Trust level, more information is available in Medium Trust Support help article.

All the best,
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
David
Top achievements
Rank 1
answered on 27 Aug 2010, 08:17 PM
Thanks for the speedy response Steve !

Yeah, I read that link and have pretty much prepared myself for the bad news on excel/pdf export but those are not deal-breakers for me.  The export to csv covers any data export functionality I would need and I can print any doc to pdf using cutepdf, but something is a-muck with rendering???

I am still willing to purchase the reporting suite if I can get the report to render to the printer like it does on my dev machine.

Any advice on rendering configuration (let's let the medium trust issue lie for now) that I may be overlooking?

thanks, dave
0
Steve
Telerik team
answered on 30 Aug 2010, 02:17 PM
Hello David,

The print functionality of the ASP.NET report viewer is basically exporting the report to PDF file and invoking the Acrobat PDF plug-in for the print, so as you see this print would not work either. What you can do is use the default browser print from the PrintAs() function with argument "Default". More information is available in the Client-Side API help article.

Mind the different printing compared to the Acrobat true print. The browser default print would only print the viewable data on the screen i.e. if the report consists of multiple pages, only the first page would be printed.

All the best,
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
David
Top achievements
Rank 1
answered on 30 Aug 2010, 06:24 PM
Thank you very much!

I don't suspect I'll have much better luck trying to get the asp.net reportviewer to print to pdf in medium trust either?

dave
Tags
General Discussions
Asked by
Azeheruddin khan
Top achievements
Rank 1
Answers by
Peter
Telerik team
Azeheruddin khan
Top achievements
Rank 1
David
Top achievements
Rank 1
Steve
Telerik team
Share this question
or