In ReportViewer, there is no data to view.

1 posts, 0 answers
  1. jai
    jai avatar
    16 posts
    Member since:
    Jan 2008

    Posted 24 Mar 2011 Link to this post

    Hi,
    Im new to telerik.reporting
    and im trying to load my dataset and binding in report, but im not able to see any data in viewer.. these are the below steps im doing..

    .aspx page

     <telerik:ReportViewer Width="100%" Height="100%" ID="ReportViewer1" runat="server" ></telerik:ReportViewer>

    .aspx.cs

    protected void Page_Load(object sender, EventArgs e)
            {
                Telerik.Reporting.Report report1 = new Telerik.Reporting.Report();
                report1.DataSource = GetDataset();
                ReportViewer1.Report = report1;            
            }

            private DataTable GetDataset()
            {
                DataSet ds = new DataSet();
                DataTable dt = new DataTable();
                DataRow dr;

                DataColumn id = new DataColumn("ID");
                DataColumn name = new DataColumn("Name");
                dt.Columns.Add(id);
                dt.Columns.Add(name);
                dr = dt.NewRow();
                dr["ID"] = 1;
                dr["Name"] = "Jeyaraman";
                dt.Rows.Add(dr);
                dr = dt.NewRow();
                dr["ID"] = 2;
                dr["Name"] = "Axiom";
                dt.Rows.Add(dr);

                ds.Tables.Add(dt);
                return dt;
            }

    Plz guide me to fix the issue...

    Thanks in advance
    Jeyaraman.S
Back to Top