Wrox Programmer Forums
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 29th, 2008, 04:58 AM
Authorized User
Join Date: Sep 2006
Posts: 37
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via MSN to VerbatimBOT Send a message via Yahoo to VerbatimBOT
Default ReportViewer problem

Hi guys,

I'm having problems when trying to load different .rdlc files dynamically into a single ReportViewer control.

Here's the code:
    private void LoadUserControl(string type)
        Label lblTitle = (Label)Parent.FindControl("lblTitle");

        Microsoft.Reporting.WebForms.ReportDataSource rpt = new Microsoft.Reporting.WebForms.ReportDataSource();
        rpt.Name = "MyDataSource";

        switch (Request["mode"].ToLower())
            case "view":
                switch (type.ToLower())
                    case "view1":
                        ReportViewer1.LocalReport.ReportPath = Server.MapPath(@"~/Reports/View1.rdlc");

                        lblTitle.Text = "VIEW 1";
                        // ods: ObjectDataSource
                        rpt.DataSourceId = odsView1.ID;
                        rpt.Value = odsView1;
                    case "view2":
                        ReportViewer1.LocalReport.ReportPath = Server.MapPath(@"~/Reports/View2.rdlc");
                        lblTitle.Text = "VIEW2";
                        // ods: ObjectDataSource
                        rpt.DataSourceId = odsView2.ID;
                        rpt.Value = odsView2;

A full screen of the code is available at http://img262.imageshack.us/my.php?image=codebe3.png

The error message I keep getting is "A data source instance has not been supplied for the data source 'Reports_NepokretnostiIzvestajPoOsnovuOduzimanja'. "

Thanks in advance

Aleksandar Dragosavac
Belgrade, Serbia
Aleksandar Dragosavac
Belgrade, Serbia

Similar Threads
Thread Thread Starter Forum Replies Last Post
ReportViewer - Table cell expression problem VerbatimBOT .NET Framework 2.0 0 September 25th, 2008 08:41 AM
Problem with printing report from reportviewer Somesh Reporting Services 1 June 30th, 2008 02:14 AM
ReportViewer Control everest ASP.NET 2.0 Professional 1 October 11th, 2007 11:37 PM
Reportviewer pzmrcd Reporting Services 0 August 24th, 2006 03:44 PM
Problem with crystal reportviewer prathima.shetty Crystal Reports 1 February 7th, 2006 10:53 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.