Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

Create RDLC Report in Asp.net Example in Visual Studio 2010 Step By Step Tutorial

Dec 15, 2014
Introduction:

Here I will explain how to create RDLC report in asp.net with example in visual studio 2010 or create RDLC report in asp.net using C# step by step process tutorial or create RDLC report using visual studio 2010 in 
asp.net with example.

Description:

In Previous posts I explained lot of articles regarding Asp.net,
Gridview, SQL Server, Ajax, JavaScript etc. Now I will explain how to create RDLC report in asp.net with example in visual studio 2010. 

RDLC is standard reporting tool for visual studio by using these we can display reports regarding employee details and display charts etc and crystal reports need minimal coding to display result. 

To implement RDLC reports first design the table in database and give name UserInfomation

ColumnName
DataType
UserId
Int(set identity property=true)
UserName
varchar(50)
FirstName
Varchar(50)
LastName
varchar(50)
Location
varchar(50)

After completion of table creation enter some dummy data because we need to use that data to populate reports. Now Open visual studio 2008 and create new website and open Default.aspx page in Design mode after that open Toolbox from that drag and drop MicrosoftReportViewer control from Reporting tab 

After drag and drop MicrosoftReportViewer in your page select ReportViewer control and click on smart tag in right side and select Design a new Report


After click on Design a new report now welcome window wizard will open


Now click on Next button after that new Data Source Configuration Wizard will open in that click on New Connection button to configure database connection.  



Now one window will open to add new connection in that enter Server Name and select authentication type either windows or SQL Server and select database name after fill all the details click on Test Connection if the connection path is correct then that will display Test connection succeeded. After that click ok  


After click ok New database connection added to dropdown now click on Next button

After click Next it will display available Tables, views, Stored Procedures and Functions in DataSource Configuration Wizard in that open Tables section and select required table previously we created table with name UserInformation now I am selecting that table from available list


After click finish our report wizard populate with our selected table now select that table and our Next button


After click Next button it will display options to select Report type either Tabular or Matrix now select Report Type and click Next Button


After click Next Report Wizard display Design the table option with available fields from previous selected table and give options like Page, Group and Details these are used to display the data based on Groupwise etc. Here we are doing simple crystal report sample I am not doing anything simply click on Next Button


After click Next button Report wizard will display option to select Table layout after select required table layout click on Next button


After click Next button Report wizard will display option to select Table style after select required table style click on Next button


After click Next button Report wizard will display Completing the Report Wizard in that enter Report Name and click Finish button


After click Finish button now it will create new report if we open our website Solution Explorer we have chance to see newly created report Report1.rdlc and xsd file in App folder this xsd file contain our selected database table.


After that Now Open Default.aspx page and select ReportViewer and click smart tag in right side in that select Report Type


Once Report1.rdlc selected Open Default.aspx Source code it contains code like this


<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana"
Font-Size="8pt" Height="342px" Width="398px">
<LocalReport ReportPath="Report1.rdlc">
<DataSources>
<rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="MySampleDBDataSet_UserInformation" />
</DataSources>
</LocalReport>
</rsweb:ReportViewer>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
SelectMethod="GetData"
TypeName="MySampleDBDataSetTableAdapters.UserInformationTableAdapter">
</asp:ObjectDataSource>
</div>
</form>
</body>
</html>
If you above code Here we added referece of assembly for Reportviewer that is necessary to run our report perfectly. Now Run your application check the output that would be like this.

Demo


Please give your comments regarding above topic is it ok or not and if you like the post please share it.

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email

11 comments :

Anonymous said...

hi sir,
here i tried this program but i got this error.i am using vs 2010.
The Report Viewer Web Control requires a System.Web.UI.ScriptManager on the web form.

Unknown said...

You should add Script Manager control before Report Viewer control in your aspx page

Anonymous said...

yes

Pappufighter,,,,,,, said...

!!!!! Shabbbas !!!!!

Unknown said...

How to create sub report in rdlc!

Unknown said...

The type 'servDataSet' already contains a definition for 'ServiceRowChangeEventHandler....i got this error wn i tried

Unknown said...

The type 'servDataSet' already contains a definition for 'ServiceRowChangeEventHandler....i got this error wn i tried

Unknown said...

It was Needful

Require your help for subreport

Anonymous said...

This Helped Me Lot.Thank you so much for the entire team who has worked hard to do this.

chiru said...

sir, I want RDLC Report Grouping with Page Break, Table Header Repeat, Group Totals and Sub Grouping.
Please provide the information.

chiru said...

my mail id : chiranjeevi1387@gmail.com

Please provide me the information

Give your Valuable Comments

Note: Only a member of this blog may post a comment.

© 2015 Aspdotnet-Suresh.com. All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.