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

Cannot get a report to show via ReportViewer

2 Answers 72 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jared
Top achievements
Rank 2
Jared asked on 27 May 2014, 10:20 PM
I have been trying to get a basic report to show up on a test page using the Telerik Reports (Trial) product, but am unable to be successful.  I have retrieved the data (in various scenarios) and bound it to the ReportViewer, but nothing shows up (not even my columns).  Am I missing something?  Code Below:


01.protected void Page_Load(object sender, EventArgs e)
02.{
03.    if(!Page.IsPostBack)
04.    {
05.        string strFakeToken = "0x00C1F7F02751764B9E03D36DC1F10C2E010000004D5FE0DA32126BFFD53944A657C59323ED483AA729D6C109632DBD0A56662191094CD17AA16E5BFAFB30C557E4F7F133";
06.         
07.        System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
08.        byte[] myByteRep = encoding.GetBytes(strFakeToken);
09. 
10.        Telerik.Reporting.SqlDataSource sdr = new Telerik.Reporting.SqlDataSource();
11.        sdr.ProviderName = "System.Data.SqlClient";
12.        sdr.ConnectionString = ConfigurationManager.ConnectionStrings["MyDBName"].ConnectionString;
13.        sdr.Parameters.Add("@settingID", System.Data.DbType.Int16, 1);
14.        sdr.Parameters.Add("@workSpaceID", System.Data.DbType.Int16, 1);
15. 
16.        sdr.Parameters.Add("@securityToken", System.Data.DbType.VarNumeric, myByteRep);
17. 
18.        sdr.SelectCommandType = Telerik.Reporting.SqlDataSourceCommandType.StoredProcedure;
19.        sdr.SelectCommand = "[SOMENAME].[ItemMasterReport]";
20. 
21. 
22.         
23.         
24.        // Access the Service to pull the Data Reader in the line below
25.        IItemMasterReportService imr = new ServiceProxy.ServiceProxy.ItemMasterReportServiceProxy();
26.        // Create Data Reader (for use below)
27.        IDataReader idr = imr.GetItemMasterReportDataReader(IdentityHelper.CurrentUser.RecentWorkspaceID,1);
28.         
29.        // Create the Data Table (to be used in the Data Source below)
30.        DataTable dt = new DataTable();
31.        dt.Load(idr);
32.        //dt.TableName = "ItemMasterReport";
33.        dt.TableName = "Budget";
34.        //dt.TableName = "Capacity";
35. 
36.        // Create the Data Source (to be used in the Report below)
37.        Telerik.Reporting.ObjectDataSource ods = new Telerik.Reporting.ObjectDataSource();
38.        ods.DataSource = dt.Rows;
39.        //ods.DataMember = dt.TableName;
40.        //ods.DataMember = "Budget";
41.        //ods.DataMember = "Capacity";
42. 
43.        // Create the Data Set (not used ??? )
44.        DataSet ds = new DataSet();
45.        ds.Load(idr,LoadOption.OverwriteChanges,string.Empty);
46. 
47.        // Build the Report (to be used in the Report Source below)
48.        Telerik.Reporting.Report report = new Telerik.Reporting.Report();
49.        //report.DataSource = ods;
50.        report.DataSource = sdr;
51. 
52.        Telerik.Reporting.InstanceReportSource irs = new Telerik.Reporting.InstanceReportSource();
53.        irs.ReportDocument = report;
54.         
55.        // Set some basic stuff for UI for diagnostic purposes
56.        usertoken.InnerText = IdentityHelper.CurrentUser.Token.ToString();
57.        workspaceID.InnerText = IdentityHelper.CurrentUser.RecentWorkspaceID.ToString();
58.        settingID.InnerText = "1";
59. 
60.        rptvwJaredTest.ReportSource = irs;
61.        rptvwJaredTest.RefreshReport(); // now that all the sub-work is done, render the report in the report viewer in the UI
62.    }
63.}

2 Answers, 1 is accepted

Sort by
0
Accepted
Stef
Telerik team
answered on 30 May 2014, 12:42 PM
Hi Jared,

A report document is actually a template you can design using our Report Designers, which template is repeated for each record in the assigned to it data. There is no auto-generate feature, so you should have created previously a report definition using fields existing in the used as data source object.

More information about starting with Telerik Reporting can be found in our Quickstart help section, the videos accompanying our online demos, and the local examples installed by default under C:\Program Files (x86)\Telerik\Reporting <VERSION>\Examples\CSharp.

Let us know if you need any further help.

Regards,
Stef
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Jared
Top achievements
Rank 2
answered on 02 Jun 2014, 02:09 PM
Stef,


It is working for me now.  I guess I missed that from the documentation, somehow.  Maybe add a video or something that includes the creation of the Report in the VS UI to clarify.


Thanks,

Jared
Tags
General Discussions
Asked by
Jared
Top achievements
Rank 2
Answers by
Stef
Telerik team
Jared
Top achievements
Rank 2
Share this question
or