This is a migrated thread and some comments may be shown as answers.

Datatable

1 Answer 127 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Anshul
Top achievements
Rank 1
Anshul asked on 20 May 2013, 03:46 PM
Hello,
I am new to Telerik software so i need your help.I want to bind datatable to reportviewer on button click (button on aspx page). The data in the ReportViewer
should be updated based on textbox value on my aspx page.

1)I am using a stored procedure which takes two arguments of DateTime type and returns a datatable. I want to Bind this Datatable to ReportViewer.
Or
2) I want to rebind DataSource on my report based on parameters passed from aspx file (2 parameters of datetime type).

Help Please

1 Answer, 1 is accepted

Sort by
0
Gimmik
Top achievements
Rank 1
answered on 22 May 2013, 04:26 PM
Hi Anshul,

The best way to handle this scenario would be to create some business logic. Crate a method that takes two DateTime  parameters, calling your Stored Procedure, and returns a DataTable or DataSet. This is the best-practice approach since it allows you to create separate layers in you project that can be maintained independently without breaking other functionality.

Once you crate the business logic, you can add a ObjectDataSource to your Report that will call that method with the two DateTime parameters.

Now, you have a choice to make. You can have the user enter the parameters on your ASPX page, but then you need to first pass the parameters into the Report - so the report can utilize them when making a call to your data access layer.

A simpler approach is to add two Report Parameters into the report itself, so the user enters the data directly into the Report using the ReportViewer.
Tags
General Discussions
Asked by
Anshul
Top achievements
Rank 1
Answers by
Gimmik
Top achievements
Rank 1
Share this question
or