Telerik Create Report

Create Report:
There are some steps to create telerik report
1. go to visual studio create a new project as ClassLibrary under Windows Template and name it as ClassLibrary1. 


2. go to ClassLibrary1 add new item select DataSet under Data Template and name it as DataSet1.xsd

 

3. go to DataSet1 window and Create new Data Table name it as Data.


4. Add columns to this table like DataColumn1, DataColumn2, DataColumn3 and build the Project ClassLibrary1
5. go to ClassLibrary1 add new item and select Telerik Report under Reporting Template and nae it as Report1.cs.




6. When you add new report then one telerik report wizard will be open.

 

7. Click add new Data Source



8. Select Object Data Source and click ok



 9. Select DataSet1 and Click Next >


 

10. Click Radio Button Choose a data source member and select DataSet1() and Click Finish >>|



11. Select objectDataSource1 and click Next >

12. Next >


 14. Select DataColumn1 DataColumn2 DataColumn3 and click Report > and click Next >

15. Next

16. Next

17. Finish >>|



18. Adjust fields according to what you need. where you want fields or Data Columns.

19. Go to solution and add new project ASP.NET Web Application



20.  Go to Default.aspx and drag Report Viewer to this page.

21. Build Solution

22. Go to WebApplication1 add reference select ClassLibrary1

24. Default.aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>

<%@ Register Assembly="Telerik.ReportViewer.WebForms, Version=6.2.12.1017, Culture=neutral, PublicKeyToken=a9d7983dfcc261be"
    Namespace="Telerik.ReportViewer.WebForms" TagPrefix="telerik" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <telerik:ReportViewer ID="ReportViewer1" runat="server"></telerik:ReportViewer>
    </div>
    </form>
</body>
</html>
 

25. Default.aspx.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ClassLibrary1;
using System.Data;

namespace WebApplication1
{
    public partial class _Default : System.Web.UI.Page
    {       

         Report1 r = new Report1();
         protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                filldata();
                this.ReportViewer1.ReportSource = r;
            }
        }

        private void filldata()
        {
            DataSet1 ds = new DataSet1();
            DataTable dt1 = ds.DataTable1;

            dt1.Rows.Add("Data1", "Data2", "Data3");        
            r.DataSource = ds;
        }
    }
}



Comments

  1. I can not find Telerik Report under Reporting Template
    Need help

    ReplyDelete
  2. Thanks for this example . I need to create columns and rows dynamically so please made a example on that

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete

Post a Comment

Popular posts from this blog

C# Copy files from one server to another

Export SharePoint Online Group Users to Excel using Powershell