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

Telerik Reporting in asp.net mvc2: How to connect data using ObjectDataSource

0 Answers 83 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
devika godse
Top achievements
Rank 1
devika godse asked on 31 Aug 2010, 12:51 PM
Hi All,
                  I am using Telerik Reporting Q2 2010 in asp.net mvc 2.

I added a report class Report1.cs(Add-> New Item -> Telerik Report Q2 2010) then in report wizard I selected objectdatasource. As guided in http://www.telerik.com/help/reporting/objectdatasource-wizard.html , I have wriiten a class Customer and class Customers. All the fields in class customer are public and following is the code for class Customers :

    [System.ComponentModel.DataObject]
    public class Customers : System.Collections.Generic.List<Customer>
    {
        [System.ComponentModel.DataObjectMethod(System.ComponentModel.DataObjectMethodType.Select)]
        public static List<Customer> GetCustomerDetails()
        {
            //Code
        }
    }

then in ObjectDataSource Wizard->Select a Business Object->the "Show data components only" check box is checked and Customers class is selected->Choose a data source member - Here the methods written in class customers are not visible.

What could be the reason???

In Controller:

        public ActionResult CustomerReport()
        {
            Report1 rptH = new Report1();
            return View("CustomerReport",rptH);
        }

For ReportViewer :
<script runat="server">                       
  protected override void OnPreRender(EventArgs e)
  {
      rvReport.Report = ViewData.Model;
  }
</script>
<form id="Form1" runat="server">  
    <telerik:ReportViewer ID="rvReport" runat="server">
    </telerik:ReportViewer>
 </form>

                         Can anyone suggest how to bind the result retrieved from the Customers:GetCustomerDetails() to Report1 and how the fields of class Customer?? How the class Customers is binded to Report1 so that its field will be visible in Data Explorer.

I have downloaded code from http://www.telerik.com/community/code-library/reporting/general/using-telerik-web-reportviewer-in-asp-net-mvc-application.aspx But the class Report1.cs in ClassLibrary1 Project gives error.

No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
devika godse
Top achievements
Rank 1
Share this question
or