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

Bound style field

3 Answers 48 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 12 Feb 2009, 09:56 AM
Hi,
We need to create a report where a field Size font is dependant from another field value:
example:
Il first field value is 12 then style font size of second one must be 12.
Is it possible to get this behavior ?
Regards
Eric

3 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 13 Feb 2009, 04:16 PM
Hello Eric,

Here is a sample code for this:

private void detail_ItemDataBound(object sender, EventArgs e)
        {
            Telerik.Reporting.Processing.DetailSection procDetail = (Telerik.Reporting.Processing.DetailSection)sender;
            Telerik.Reporting.Processing.TextBox txt1 = (Telerik.Reporting.Processing.TextBox)procDetail.ChildElements.Find("textBox1", true)[0];
            Telerik.Reporting.Processing.TextBox txt2 = (Telerik.Reporting.Processing.TextBox)procDetail.ChildElements.Find("textBox2", true)[0];
            if (txt1.Text == "12")
            {
                txt2.Style.Font.Size = new Unit(12, UnitType.Point);
            }
        }


All the best,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Rebecca
Top achievements
Rank 1
answered on 06 Nov 2012, 12:57 PM
Hi,
I want to do the same thing, but with a panel, ... when don't have any information on the table (inside the panel), the table isn't visile.
I did a itemdatabound, but I haven't success.
could you help me??
thanks.
0
Steve
Telerik team
answered on 08 Nov 2012, 05:00 PM
Hi Rebecca,

This forum thread is almost four years old and the product API has changes since. Still if you copy and paste the provided code and try to build, the warning messages would instruct you what needs to be changed. For your convenience, find a working code snippet for the latest Q3 2012 version:

private void detail_ItemDataBound(object sender, EventArgs e)
      {
          Telerik.Reporting.Processing.DetailSection procDetail = (Telerik.Reporting.Processing.DetailSection)sender;
          Telerik.Reporting.Processing.TextBox txt1 = (Telerik.Reporting.Processing.TextBox)ElementTreeHelper.GetChildByName(procDetail, "textBox1");
          Telerik.Reporting.Processing.TextBox txt2 = (Telerik.Reporting.Processing.TextBox)ElementTreeHelper.GetChildByName(procDetail, "textBox2");
          if (txt1.Value != null)
          {
              txt2.Style.Font.Size = new Unit(Convert.ToDouble(txt1.Value), UnitType.Point);
          }
      }


Kind regards,
Steve
the Telerik team

HAPPY WITH TELERIK REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

Tags
General Discussions
Asked by
Eric
Top achievements
Rank 1
Answers by
Steve
Telerik team
Rebecca
Top achievements
Rank 1
Share this question
or