Solved

Bind Gridview Results to Report Viewer

Posted on 2012-03-14
6
2,431 Views
Last Modified: 2012-03-25
I have a web page with a gridview on it.  The gridview results are based on a data view through a session variable.

I need to bind the gridview results to report viewer, so that what's in the gridview shows in the report.

Anyone know of a quick concise way to get this accomplished?

Thanks!
0
Comment
Question by:jordanhelen
  • 3
  • 3
6 Comments
 
LVL 9

Expert Comment

by:abhinayp86
Comment Utility
a better way is to use asp.net reportviewer and give it all the parameters required.
0
 

Author Comment

by:jordanhelen
Comment Utility
Can you detail a little bit more?  I already have the gridview populating with data and need to populate report view with the data from the gridview.

Thanks.
0
 
LVL 9

Expert Comment

by:abhinayp86
Comment Utility
something like this.
http://www.codeproject.com/Articles/15597/Using-the-ASP-NET-2-0-ReportViewer-in-Local-Mode

Since you dont have database in picture,
create an empty ssrs report, then use asp.net reportviewer control and give it a datatable (convert ur dataview into datatable)

in short, here are the things you need to set for the reportviewer control
ReportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local 
        ReportViewer1.LocalReport.ReportPath = System.Environment.CurrentDirectory & "\yourReportName.rdlc" 
        ReportViewer1.LocalReport.DataSources.Clear() 
        ReportViewer1.LocalReport.DataSources.Add(New Microsoft.Reporting.WinForms.ReportDataSource("urDatasetNameInSSRS", yourDataTable)) 
        ReportViewer1.DocumentMapCollapsed = True 
        ReportViewer1.RefreshReport() 

Open in new window

0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:jordanhelen
Comment Utility
Thank you.

I think I need to make myself a little clearer, sorry.

The report is not in SSRS, it is in Report Viewer and Report Viewer is on an .aspx page.
The gridview is on a separate .aspx page.
After the user filters the gridview and get results, a button (Print Report) is available on this page for the user to open report viewer and view, print or download the filtered data in the gridview.

For the gridview I have a dataset (mydataset)
A datatable (mydatatable)  equals the dataset
A dataview (mydataview) equals the datatable
And a session variable (mycriteria) equals the dataview.

In the Print Report on_click event, what would be the best way to retrieve the gridview’s filtered data so that it populates report viewer?
0
 
LVL 9

Accepted Solution

by:
abhinayp86 earned 500 total points
Comment Utility
ohk.. So u essentially want another page or popup to just show the filter results and print or download them.

Say, Page1.aspx -- ur main gridview page
Create a new page Page2.aspx and put another gridview in it.

if page 1, when u click filter, save all your filter settings in another session variable in some format . Now after user clicks print report in page 1, open page2.aspx as a popup.
Since you have your filter settings and your dataview in session, they will also be available in page2.
So in Page2's page load, filter your dataview automatically and bind it to the gridview. Now to download that gridview, use the export to excell function here
http://web.archive.org/web/20101125095729/http://mattberseth.com/blog/2007/04/export_gridview_to_excel_1.html
0
 

Author Comment

by:jordanhelen
Comment Utility
Thank you.

Actually I can only have one page with a gridview.  
I have created a session variable that holds this page's gridview selected value.
Now, how to get these values into report viewer is my issue.
I appreciate any detailed help with this.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now