 |
|
 |
This article is great... Thanks a lot!!!
Priya
|
|
|
|
 |
|
|
 |
|
 |
hi priya,
you can fetch the data from ObjectDataSource object which contains all the report data, in a DataTable. and the you can write your own customized Report. look at this code: HTML SOURCE OF DEFAULT PAGE:
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt" Height="768px" Width="1024px" OnBack="ReportViewer1_Back" OnDataBinding="Page_Load" önInit="Page_Load" BorderColor="Black" BorderStyle="Solid" SkinID="1" ToolBarItemBorderStyle="Groove">
Code Behind: using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { MyDataAdapter psk = new MyDataAdapter(); DataTable dt = new DataTable(); dt = psk.GetData(); Response.Write(""); for (int i = 0; i < dt.Rows.Count; i++) { Response.Write(""); for (int j = 0; j < dt.Columns.Count; j++) Response.Write("" + dt.Rows[i][j].ToString() + " | "); Response.Write(" "); } Response.Write(" ");
} }
public class MyDataAdapter : DataSet2TableAdapters.Products_by_CategoryTableAdapter { public override DataSet2.Products_by_CategoryDataTable GetData() { return base.GetData(); }
}
<asp:ObjectDataSource ID="ObjectDataSource2" runat="server" SelectMethod="GetData" TypeName="DataSet2TableAdapters.Products_by_CategoryTableAdapter">
PS Kaushik
|
|
|
|
 |
|
 |
I want to ask a general question about using report viewer of .NET 2005. Does it require to install the visual studio 2005 on the machine in order to run an application that contains a report viewer or it can run using the .NET framework 2.0 only??
Thanks in advance
lamees
|
|
|
|
 |
|
 |
You do not need to install Visual Studio on the client.
The Report Viewer is a redistributable package that will be deployed with your setup project. The Report Viewer is also available as an ASP.Net control which can be viewed with any browser.
See http://www.gotreportviewer.com/[^] for more info.
- Robert R Freeman
|
|
|
|
 |
|
 |
I want to know if this report can be generated dynamically ( from the runtime) thanx in advance
lamees
|
|
|
|
 |
|
 |
Yes, the report file can be generated dynamically. You can see the examples from "www.gotreportviewer.com".
|
|
|
|
 |
|
 |
Robert,
Thanks for the very informative tutorial. I, like many, searched for a report serices tutorial only to find very limited information.
I do have one question that I'm hoping you can answer. I have a table with a total of six columns displaying 3 fields. I have set the columns to look like this;
col1 col2 col3 col1 col2 col3
I would like to fill the table horizontally with the first record on the left, the second on the right, and the third on the left on the next line. Is this possible? If so, how can I do this.
Thanks again!
|
|
|
|
 |
|
 |
The only thing I can think of is to add three columns to the Datatable and then recurse through it to create the structure you want. You would need to do any sorting in the initial query.
Ex with 1 column (made to two columns):
For i As Integer = 0 To (DataSet1.DataTable1.Count - 1) / 2
  If i < DataSet1.DataTable1.Count - 1 Then     DataSet1.DataTable1(i)(1) = DataSet1.DataTable1(i + 1)(0)     DataSet1.DataTable1(i + 1).Delete()   End If Next
|
|
|
|
 |
|
 |
Hello..
First of all, good article.
You have explained master-detail grouping when only 1 table is present. That table contains all the data we are going to group (maybe one SELECT statement has joined 2 hierarchical tables), but, what if I have 2 hierarchical tables without joining them to get only 1 result set?
For example, if I have a Categories Table, and as a child, I have the Products Table. The key is CategoryId. I couldn't do what you explained here with this scenario.
Can you send me a hint how to do this? Thanks
Jaime
|
|
|
|
 |
|
|
 |
|
 |
Hey there,
Thanks for the article. I stumbled across it when I was trying to find out if there was anyway to get the new reportviewer control to display data in an async fashion. I have have a few reports that have literally thousands of rows of data, and for this reason, after I dynamically add the datasource (and custom dataset) to the reportviewer, I found that the reportViewer crashes(and in turn crashes my app) after the .RefreshReport() call.
Do you know of anyway to either page the data, or only display a subset of the data at a time?
Thanks
Ryan
|
|
|
|
 |
|
 |
You can set page breaks if you have a logical grouping structure as in the article above. Also see this article for general page break info: http://msdn2.microsoft.com/en-us/library/ms156282.aspx[^]
Or if you just want to display x records at a time, you would use a navigation UserControl (i.e. L/R buttons and a textbox) and two datatable instances (one to bind the report to and the other to hold the data) on the form. Load all the data into the holding table and copy the desired rows into the bound table via the navigation control.
- Robert R Freeman
|
|
|
|
 |
|
 |
hi, i am using sharpdevelop (.net IDE)
can i use this this control ?
regards
anish
|
|
|
|
 |
|
|
 |
|
 |
Good Article!
Is there a way to put page numbers on the report when it is printed?
Thanks, Don
|
|
|
|
 |
|
|
 |
|
 |
I have no idea to print the rdlc type report without use of reportviewer, any body can give me the sugguestion ? Many thanks!!!!
|
|
|
|
 |
|
|
 |
|
 |
with some changes the below link is what you wanted http://msdn2.microsoft.com/en-us/library/ms252091(VS.80).aspx
|
|
|
|
 |
|
 |
I have built a report using your example except that I'm trying to fill the dataTable with a stored procedure. I am receiving a similar message for each column I'm returning to the dataTable: "Argument not specified for 'parm_Active' of 'Public Overridable Overloads Function Fill(dataTable as AMSDataSet.sp_Select_DelvStat_by_ZipCodeTable,...)" where in this case parm_Active is the column returned to the dataTable
You can probably guess I'm relatively new at this, but any help would be greatly appreciated!
Thanks!
-- modified at 12:14 Thursday 11th May, 2006
|
|
|
|
 |
|
 |
Hi all,
Actually while displaying the report I want to apply [WHERE] condition, can anybody please help me reg. this.
With Thanks, S. Kumar
|
|
|
|
 |
|
 |
Hi, you can bind report at runtime. using this
SqlDataAdapter ada = new SqlDataAdapter("Select * from tblprojects" ,strConn); DataSet ds = new DataSet(); ada.Fill(ds);
ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1_tblProjects", ds.Tables[0])); ReportViewer1.DataBind();
Things to consider while runtime databinding 1. If report viewer is already databound, you must remove it, before binding with new one ReportViewer1.LocalReport.DataSources.RemoveAt(0); Otherwise it ll keep on displaying old data. 2. DataSource name passed as parameter to ReportDataSource(in this case "DataSet1_tblProjects" ) must be same as dataSource name used at design time in report. You can check the datasource name as follow 1. Open the .rdlc report in visual studio. 2. Select Reports from main menu 3. Select Data Sources. This opens a dialog box which contains the Report Data source.
Hopefully this will solve your problem.
|
|
|
|
 |
|
 |
I am updating the article to include a Filtering Section.
Here is the updated text: Advanced 1. Filter the results (Where clause) Right-click the DataSet in the Solution Explorer and select View Designer
Right-click the TableAdapter section of the DataTable and select Configure...
Modify the SQL statement to include the Where clause. For SQL server you would use a named parameter @CategoryId. OleDb Adapters require ? parameters. Click Finish Add appropriate controls to your form to provide the parameter value. Move the code to fill the adapter and refresh the report from the Form Load event to the event that will load the report. Ex: "Go" button Click event. Provide the required parameter in the Adapter's Fill method.
- Robert R Freeman
|
|
|
|
 |
|
 |
great article but i need to do all this in code behind. I need some thing like ..... SqlDataAdapter adp = new SqlDataAdapter(strSQL, strConn); DataSet ds = new DataSet(); adp.Fill(ds.Tables[0]);
ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("prj",ds.Tables[0]); ReportViewer1.DataBind();
But it is not working..Can u help me? Thanks
|
|
|
|
 |