Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. ReportViewer on UserCotrol

ReportViewer on UserCotrol

Scheduled Pinned Locked Moved C#
designhelp
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    irinabe
    wrote on last edited by
    #1

    Hello, When I'm placing ReportViewer on a from and design a report.rdcl for it, a BindingSource object is automatically generated for me. However' when I place the ReportViewer on a UserControl, the BindingSource object isn't created and no report is displayed. Is it a problem in my logic/code or is it a known limitation ... any how, if you have any kind of suggestions ... I'll be more then happy to listen :) Thanks in advance

    C 1 Reply Last reply
    0
    • I irinabe

      Hello, When I'm placing ReportViewer on a from and design a report.rdcl for it, a BindingSource object is automatically generated for me. However' when I place the ReportViewer on a UserControl, the BindingSource object isn't created and no report is displayed. Is it a problem in my logic/code or is it a known limitation ... any how, if you have any kind of suggestions ... I'll be more then happy to listen :) Thanks in advance

      C Offline
      C Offline
      carbon_golem
      wrote on last edited by
      #2

      No data == no report. Did you expect something else? Scott P

      “It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.” -Edsger Dijkstra

      I 1 Reply Last reply
      0
      • C carbon_golem

        No data == no report. Did you expect something else? Scott P

        “It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.” -Edsger Dijkstra

        I Offline
        I Offline
        irinabe
        wrote on last edited by
        #3

        Hi. Why are you picking on on words? :) My real question was wether it was possible to put a reportViewer on a UserControl and how to make the BindingSource object to be created? Thanks again

        C 1 Reply Last reply
        0
        • I irinabe

          Hi. Why are you picking on on words? :) My real question was wether it was possible to put a reportViewer on a UserControl and how to make the BindingSource object to be created? Thanks again

          C Offline
          C Offline
          carbon_golem
          wrote on last edited by
          #4

          It is possible to put the ReportViewer on a UserControl, however I don't think it necessary as it already is a control. To bind to objects, you first have to have an object with the data that you want to display. Note that how you want to display the data has an impact on how you should construct the objects. I started with the display, then worked back to the objects that I needed to fill and then created FactoryMethods to process data in my application to fill those "report objects". In the example below, iData.GetHeader() returns a List<Header>. If you're still unsure, you should consider getting a book on report services, it's a broad topic with slim resources on the internet.ReportDataSource rpd1 = new ReportDataSource("Logic_Header", iData.GetHeader()); ReportDataSource rpd2 = new ReportDataSource("Logic_DataA", iData.GetReportDataA()); ReportDataSource rpd3 = new ReportDataSource("Logic_DataB", iData.GetReportDataB()); viewer.LocalReport.SetParameters(GenerateGenrlReportParams(GetCorrectedFont(myFont))); viewer.LocalReport.DataSources.Add(rpd1); viewer.LocalReport.DataSources.Add(rpd2); viewer.LocalReport.DataSources.Add(rpd3); viewer.RefreshReport();
          Scott P

          “It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.” -Edsger Dijkstra

          I 1 Reply Last reply
          0
          • C carbon_golem

            It is possible to put the ReportViewer on a UserControl, however I don't think it necessary as it already is a control. To bind to objects, you first have to have an object with the data that you want to display. Note that how you want to display the data has an impact on how you should construct the objects. I started with the display, then worked back to the objects that I needed to fill and then created FactoryMethods to process data in my application to fill those "report objects". In the example below, iData.GetHeader() returns a List<Header>. If you're still unsure, you should consider getting a book on report services, it's a broad topic with slim resources on the internet.ReportDataSource rpd1 = new ReportDataSource("Logic_Header", iData.GetHeader()); ReportDataSource rpd2 = new ReportDataSource("Logic_DataA", iData.GetReportDataA()); ReportDataSource rpd3 = new ReportDataSource("Logic_DataB", iData.GetReportDataB()); viewer.LocalReport.SetParameters(GenerateGenrlReportParams(GetCorrectedFont(myFont))); viewer.LocalReport.DataSources.Add(rpd1); viewer.LocalReport.DataSources.Add(rpd2); viewer.LocalReport.DataSources.Add(rpd3); viewer.RefreshReport();
            Scott P

            “It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.” -Edsger Dijkstra

            I Offline
            I Offline
            irinabe
            wrote on last edited by
            #5

            Thank you for your answer, it helped :) (And I also found a mistake in my steps :sigh: )

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups