Report Generation in asp.net without CrystalReports................................

Unknown | 6:25 AM |

DLLs are:
Microsoft.ApplicationBlocks.Data.dll
Microsoft.ReportViewer.Common.dll
Microsoft.ReportViewer.ProcessingObjectModel.dll
Microsoft.ReportViewer.WebForms.dll
Microsoft.ReportViewer.WinForms.dll


AttendanceReport.aspx



<%@ Page Title="" Language="C#" MasterPageFile="~/SuccessPlus/Admin/adminsuccess.master" AutoEventWireup="true" CodeFile="AttendanceReport.aspx.cs" Inherits="SuccessPlus_Admin_Default2" %>

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script type="text/javascript" language="javascript">
    function printPage() {
        window.print();
    }
    </script>
     <input id="hdndranch" runat="server" type="hidden" />
      <input id="hdnmanager" runat="server" type="hidden" />
 <input type="image" src="~/images/print.gif" onclick="printPage();" runat="server" id="print"
            disabled="disabled"/>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:Label ID="Label1" runat="server" Text=""></asp:Label>
    <rsweb:ReportViewer ID="ReportViewer1" runat="server" Width="852px"
            Font-Names="Verdana" Font-Size="8pt" Height="502px"
            InteractiveDeviceInfos="(Collection)" WaitMessageFont-Names="Verdana"
            WaitMessageFont-Size="14pt"  KeepSessionAlive="false" ProcessingMode="Local" ShowPrintButton="true" >    
            <LocalReport ReportPath="SuccessPlus\AttendanceReport.rdlc" >          
       </LocalReport>
        </rsweb:ReportViewer>
</asp:Content>

AttendanceReport.aspx.cs


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.Reporting.WinForms;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Web.Security;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using Microsoft.ApplicationBlocks.Data;
using Microsoft.Reporting.WebForms;
using System.IO;



public partial class SuccessPlus_Admin_Default2 : System.Web.UI.Page
{
 

    Class1 cs = new Class1();
    string pathname = null;

    public SqlParameter[] SearchValue = new SqlParameter[1];
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            try
            {

                if (Request.QueryString.Count != 0)
                {
                    hdndranch.Value = Request.QueryString["branch"].ToString();
                    hdnmanager.Value = Request.QueryString["manager"].ToString();
                }
             

                print.Disabled = false;
                ReportViewer1.Visible = true;
                ReportViewer1.ShowPrintButton = true;
                //ReportViewer1.ProcessingMode = ProcessingMode.Remote;



                System.Data.DataSet thisDataSet = new System.Data.DataSet();
                if (hdndranch.Value == "")
                {
                    SearchValue[0] = new SqlParameter("@branch",
                                    "0");
                    thisDataSet = SqlHelper.ExecuteDataset(cs.con, "getAttendaceReport", SearchValue);
                }
                else
                {
                    SearchValue[0] = new SqlParameter("@branch",
                                     hdndranch.Value);
                    thisDataSet = SqlHelper.ExecuteDataset(cs.con, "getAttendaceReport", SearchValue);
                }

                Microsoft.Reporting.WebForms.ReportDataSource datasource = new
                 Microsoft.Reporting.WebForms.ReportDataSource("AttDS", thisDataSet.Tables[0]);

                ReportViewer1.LocalReport.DataSources.Clear();
                ReportViewer1.LocalReport.DataSources.Add(datasource);

             
                if (thisDataSet.Tables[0].Rows.Count == 0)
                {
                    Label1.Text = "Sorry, no products under this category!";
                }

                ReportViewer1.LocalReport.Refresh();



            }
            catch (Exception ex)
            {
            }
        }
    }
}

Category:

About http://dotnetvisual.blogspot.in/:
DOT NET TO ASP.NET is a web application framework marketed by Microsoft that programmers can use to build dynamic web sites, web applications and web services. It is part of Microsoft's .NET platform and is the successor to Microsoft's Active Server Pages (ASP) technology. ASP.NET is built on the Common Language Runtime, allowing programmers to write ASP.NET code using any Microsoft .NET language. create an application very easily ....