Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8833127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:42:20+00:00 2026-06-14T08:42:20+00:00

I can see that there are many questions already being asked regarding the same

  • 0

I can see that there are many questions already being asked regarding the same thing
like:

Binding a datasource to a rdl in report server programmatically – SSRS

SSRS using Xml datasource [WCF], its possible, but is it advisable?

and many others…

But, what I really want is to have your valuable opinion before I start something and finally find myself at a dead-end !

We are developing reports in BIDS SSRS 2008 environment, VS 2010 for a Web application.
with ReportViewer 10 having ProcessingMode="Remote"

Until now, everything was ok.. passing parametetes to report, integration with asp.net etc. I mean, getting the data through SQL queries (and sometimes filtering through paramters). I could use Stored Procedures and all is working fine.

But now, there are reports which need to be generated dynamically, based on the user selection of the data from front-end, (a GridView ), on an asp.net webpage, and then display that data on the report.

That is, if a user selects 10 rows on a GridView and clicks the print button, then only those 10 rows (along with some other report specific data) should be displayed in the report. That’s what we have in the legacy system, which we are upgrading now.
and of course, this cannot be achieved merely through passing the parameters, because selection of data on the GridView depends all on the user, and is all dynamic. .. there I am in a fix now!

So, what can be the best approach for these kinds of situations?

P.S (Edit): there are solutions out there but they are more pertaining to .rdlc , and I am talking about .rdl

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T08:42:22+00:00Added an answer on June 14, 2026 at 8:42 am

    Finally we implemented it like the following . I thought may be it is of some use to others. So am posting my solution:
    This can be done with the implementation of XML
    First convert your data into XML, like following:

    private void ConvertToXml(ref XmlDocument xm)
    {
     const string header = @"<ENVELOPE>";
     var strenvelopes = "";
     GridItemCollection selectedRows;
     selectedRows = dgAddressList.SelectedItems;
    
    if (selectedRows.Count > 0)
    {
     foreach (GridItem item in dgAddressList.SelectedItems)
     {                 
      strenvelopes += @"<ADDRESS>" + 
      "<NAME>" + "<![CDATA[" + ((object[])(item.DataItem))[2].ToString() + "]]>" + "</NAME>" +
      "<CONTACT>" + "<![CDATA[" + ((object[])(item.DataItem))[1].ToString() + "]]>" + "</CONTACT>" +
      "<STREET>" + "<![CDATA[" + ((object[])(item.DataItem))[3].ToString() + "]]>" + "</STREET>" +
      "<SUBURBSTATE>" + "<![CDATA[" + ((object[])(item.DataItem))[4].ToString() + "]]>" + "</SUBURBSTATE>" +
      "</ADDRESS>";                  
      }
    }
    
       const string footer = @"</ENVELOPE>";  
    
       var envelopes = header + strenvelopes + footer;
       xm.LoadXml(envelopes);
    }
    

    You need to replace ((object[])(item.DataItem))[].ToString() with your own values

    Then generate your report like following :

    private void GenerateReport()
    {
           var xm = new XmlDocument();
           ConvertToXml(ref xm);
           var xml = xm.InnerXml.ToString();
           rptViewer = ucrvEnvelope.FindControl("rptViewer") as ReportViewer;
           if (rptViewer != null)
           {
               rptViewer.ProcessingMode = ProcessingMode.Remote;              
               rptViewer.ServerReport.ReportServerUrl = new Uri("http://localhost/MyReports");
               rptViewer.ServerReport.ReportPath = "/Reporting/rptEnvelope";
               rptViewer.PromptAreaCollapsed = true;
           }
            ReportParameter myParam = new ReportParameter("list", xml);
            rptViewer.ServerReport.SetParameters(new ReportParameter[] { myParam });
            rptViewer.ShowParameterPrompts = false;
            rptViewer.ShowBackButton = true;
            rptViewer.ServerReport.Refresh();
      }
    

    You should add a Parameter "list" to your report. because we will be passing whole XML thing to this "list" through the following Dataset,

    Now the Dataset that will handle this XML:
    Normally, what we do is you write some stored procedure or write some query inside the dataset, since ours is the XML, it needs to be handled XML way,
    With the Query Type: Text write the following query to handle the XML data

    DECLARE @docHandle int DECLARE @xmlDocument varchar(max); DECLARE @listXML nvarchar(max)
    SET @listXML = @list
    SET @xmlDocument = @listXML EXEC sp_xml_preparedocument @docHandle OUTPUT, @xmlDocument
        SELECT * FROM OPENXML (@docHandle, N'/ENVELOPE/ADDRESS') WITH
        (
          NAME nvarchar(max) 'NAME',
          CONTACT nvarchar(max) 'CONTACT',
          STREET nvarchar(max) 'STREET',
          SUBURBSTATE nvarchar(max) 'SUBURBSTATE'
        )
    

    The Fields NAME, CONTACT etc. should be the same with what you created the XML document in the first place, at the top ConvertToXML

    So the bottom line is, you are not passing data to report through strored procedure from DB but you are actaully grabbing data from aspx page – Code behind and converting the same to XML and passing it to your report-server report via this Dataset
    So whats in the code behind is passed to your report.. voila !

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There maybe some simlar questions to this but I can't see anything that really
I know there are many questions like this already on SO but none of
In the android we can see that there is a default google search on
I'm currently playing with C, C++ and ASM. I can see that there's always
Following is my ListView adapter. You can see in it that there is a
I can see that GD library is for images. But I can't see differences
I can see that Collections.unmodifiableSet returns an unmodifiable view of the given set but
I can see that the PopUp dropdown of a combobox gets closed if we
In SQL Profiler you can see that very simple updates to a table by
In the following program you can see that each value slightly less than .5

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.