Telerik Forums
Reporting Forum
3 answers
300 views
Hi,
    I want to create a telerik report bearing the contents coming from a dataset. The report is to be created at runtime as the number of rows and columns of the dataset may vary depending on the stored procedure fired. I want to display the header on each and every page after exporting report to PDF. For displaying the header, I have created a function named "DisplayHeader()". I have currently displayed the header for the report in the detail section (and not in the header section) because the report was not displaying all the column headers on one line. I have pasted the code below :


        public Report_PDF()

        {

            /// <summary>

            /// Required for telerik Reporting designer support

            /// </summary>

            InitializeComponent();

            DBUtilReport db = new DBUtilReport(Connectionstring);

            DataSet ds = new DataSet();

            SqlCommand cmd = new SqlCommand();

            cmd.CommandType = System.Data.CommandType.Text;

            cmd.CommandText = "select * FROM Tablename";

            db.FillDataSet(cmd, ref ds);

            

            Unit a = new Unit(100, UnitType.Pixel);

            Unit b = new Unit(100, UnitType.Pixel);

            Unit m = new Unit(10, UnitType.Pixel);

            Unit n = new Unit(40, UnitType.Pixel);

      

            int cols = ds.Tables[0].Columns.Count;      

            int paperWidth = 297;           

            int width = paperWidth / cols;

            Unit TxtBoxWidth = new Unit(width, UnitType.Pixel)+n;

            Unit k1 = new Unit(5.0, UnitType.Pixel);

            DisplayHeader(m,k1,a,ds);

            m = m + n + m;

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)

            {

                Unit k = new Unit(10.0, UnitType.Pixel);

                for (int j = 0; j < ds.Tables[0].Columns.Count; j++)

                {

                    Telerik.Reporting.TextBox txtData = new Telerik.Reporting.TextBox();

                    txtData.Multiline = true;

                    txtData.TextWrap = true;

                    txtData.Style.TextAlign = HorizontalAlign.Left;

                    txtData.Style.VerticalAlign = VerticalAlign.Top;

                    txtData.Style.Font.Name = "Verdana";

                    txtData.Value = ds.Tables[0].Rows[i][j].ToString();

                    txtData.Height = new Unit(75, UnitType.Pixel);

                    txtData.Width = new Unit(100, UnitType.Pixel);

                    txtData.Left = k;

                    txtData.Top = m;

                    txtData.CanShrink = true;

                                  

                    this.detail.Items.Add(txtData);

                    k = k + a;

                }

                m = m + b;

            }

         // function for displaying the header

        protected void DisplayHeader(Unit m,Unit k1,Unit a,DataSet ds)

        {

            for (int i = 0; i < ds.Tables[0].Columns.Count; i++)

            {

                Telerik.Reporting.TextBox txtHeader = new    Telerik.Reporting.TextBox();

                txtHeader.Multiline = true;

                txtHeader.TextWrap = true;

                txtHeader.Style.TextAlign = HorizontalAlign.Left;

                txtHeader.Style.VerticalAlign = VerticalAlign.Top;

                txtHeader.Style.Font.Name = "Verdana";

                txtHeader.Style.Font.Bold = true;

                txtHeader.Value = ds.Tables[0].Columns[i].ColumnName.ToString();

                txtHeader.Height = new Unit(75, UnitType.Pixel);

                txtHeader.Width = new Unit(100, UnitType.Pixel);

                txtHeader.Left = k1;

                txtHeader.Top = m;

                txtHeader.CanShrink = true;

               

                this.detail.Items.Add(txtHeader);

                k1 = k1 + a;

            }

        }

        
Steve
Telerik team
 answered on 06 Feb 2009
2 answers
174 views
Is it possible to bind Telerik reporting and WCF?  If so, do you have any examples?

Thank you,
Chris
k f
Top achievements
Rank 1
 answered on 06 Feb 2009
5 answers
360 views
Hi

I have a main report which uses an xml file (to DataTable) as a datasource containing Member ID's.
I also have a subreport for the Member's Addresses.

As each Member is processed in the main report I want to pass the MemberID to the subreport, where I then pass the MemberID into as a parameter in DataAdapter.Fill() method.

I have already implemented the passing of parameters into the DataAdapter and also implemented properties in the subreport to store the parameters being passed from the main report. As so:

 public partial class PersonalSubReport : Telerik.Reporting.Report 
    { 
        private int _paramOid; 
        private int _paramMemberId; 
 
        public PersonalSubReport() 
        { 
            /// <summary> 
            /// Required for telerik Reporting designer support 
            /// </summary> 
            InitializeComponent(); 
 
            // TODO: This line of code loads data into the 'dsMemberPersonalDetails.dsMemberPersonalDetailsTable' table. You can move, or remove it, as needed. 
            try 
            { 
                this.dsMemberPersonalDetailsTableAdapter1.Fill((this.dsMemberPersonalDetails.dsMemberPersonalDetailsTable), _paramOid, _paramMemberId); 
            } 
            catch (System.Exception ex) 
            { 
                // An error has occurred while filling the data set. Please check the exception for more information. 
                System.Diagnostics.Debug.WriteLine(ex.Message); 
            } 
        } 
 
        public int ParamOid 
        { 
            get 
            { 
                return _paramOid; 
            } 
            set 
            { 
                _paramOid = value; 
            } 
        } 
 
        public int ParamMemberId 
        { 
            get 
            { 
                return _paramMemberId; 
            } 
            set 
            { 
                _paramMemberId = value; 
            } 
        } 

My question is....when do I set the properties?
I tried setting them in the main report sections item databinding event but this occurs after the subreport's DataAdapter.Fill() method is called so parameters being passed are 0 and no data is being returned in the subreport.

Many thanks.




Michael
Top achievements
Rank 2
 answered on 05 Feb 2009
1 answer
76 views
i am using the code defined in knowlegde base section for showing alternate items with different styles using itemDatabound event handler.....i tried it, but having a little difficulty.....its working fine but for each odd page. Although i havent touched anything like page settings...But its showing alternate items with alternate styles in one page, and dont shows any item in next page, then shows in another page n so on....plz help me
Steve
Telerik team
 answered on 05 Feb 2009
11 answers
154 views
Is there an example of using ajax with ReportViewer?  I am using 2008 Q2
Steve
Telerik team
 answered on 05 Feb 2009
3 answers
64 views
Dear Community,

I am currently struggling with some minor issues regarding filtering on my data. So far, I have followed the help tutorial file located on the telerik help section, and have a filtering that looks something like this (in my detail section on the master-report page):

--------------------------------
user: foo
                    - item a
                    - item b

user: bar
                    - item c
--------------------------------

I suppose this might require a bit more detailed explaination, as the above example may not suffice. In my data I have a number of users, each user may have one or more items. If a user has more then one item bound, the user will only be shown once, hence the items are listed under the username. This is currrently what I have gotten, so far so good.

My problem comes down to splitting up the data a bit more then this. I would like to be able to have the filtered user in the header of the masterpage, not the detail section, and then have the items bound to that specific user shown in the detail section. Furthermore, for every user I filter, I would like to make a pagebreak, hence creating a new page with a new header labled the new user. So, for the above example I would like to have 2 pages, one with the user "foo" in the header, and the items "item a" and "item b" in the detail section, as well as user "bar" with item "item c" on page 2.

If anyone has a good way of implementing this, or surgestions to my problem, please let me know.

Kind regards,
Søren Engel
Mark Russell
Top achievements
Rank 1
 answered on 04 Feb 2009
6 answers
376 views
I would like to make a report that has two grids/outputs on it.  How can I do this?  The report i created only has a reportHeader, labelsGroupHeader, detail, labelGroupFooter, and Footer.  The page does not seem to get any larger so I can add another little report/grid in this one report.  Any ideas?
Mike
Top achievements
Rank 1
 answered on 04 Feb 2009
3 answers
150 views
How do I get a line to go all the way across?

column 1                       column 2

--------------------------------------
Column 1 Total          Column 2 Total
Steve
Telerik team
 answered on 04 Feb 2009
3 answers
101 views
I have deployed some reports to my production server, all was going well until i ran the reports first the date fields did not display the calendar icon, then the field that is a drop down as another filter to another table is empy and a red icon is shown and showing Invalid Value. I have deployed the dll from my project and the objects from the reporting /bin. Is there anything else i need to deploy for the report to display correct and run?

Many Thanks

Mark
Steve
Telerik team
 answered on 04 Feb 2009
1 answer
101 views
I have created some reports and deployed to my server, but it occured to me that i used the external facing ip address from my development server to the live database server. Because the server is behind a firewall i should use the NAT'd ip address but cannot find where i can change the connection string settings once i the datasource has been created. Can anyone point me in the right direction please.

Mark
Steve
Telerik team
 answered on 04 Feb 2009
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?