Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Report Header Text Customization (Read 4631 times)
Vikas Kumar
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 18
Joined: Mar 1st, 2011
Report Header Text Customization
Oct 25th, 2011 at 8:06am
Print Post  
Hi,

I have been using your reporting tool since last 5-6 months. Everything is working fine and it is fulfilling my requirements.

A new requirement has come to change the text of a header in a data range dynamically.

below is code :

Code
Select All
<DataTemplate>
                        <r:ItemContainer Size="100%,20"  Background="#99ECF9">
                                        <r:Label Text="Vehicle Name" Location="1%,2" Size="30%,20"  FontSize="11"  FontWeight="Bold" />
                                        <r:Label Text="Rating" Location="30%,2" Size="10%,20"  FontSize="11"  FontWeight="Bold"   />
                                        <r:Label Text="GRPs" Location="40%,2" Size="10%,20"  FontSize="11"  FontWeight="Bold"   />
                                        <r:Label Text="Ad Cost" Location="50%,2" Size="10%,20"  FontSize="11"  FontWeight="Bold"   />
                                        <r:Label Text="CPM MSG" Location="60%,2" Size="10%,20" FontSize="11"   FontWeight="Bold"    />
                                        <r:Label Text="Uses" Location="70%,2" Size="10%,20" FontSize="11"   FontWeight="Bold"   />
                                        <r:Label Text="Total Cost" Location="80%,2" Size="10%,20" FontSize="11"  FontWeight="Bold"   />
                                        <r:Label Text="Mix %" Location="90%,2" Size="10%,20" FontSize="11"  FontWeight="Bold"  />

                        </r:ItemContainer>
                    </DataTemplate>


 



here i need to change the text of Mix % label(last one) at run time.
can I bind this data. please let me know how to accomplish this.

Regards
Vikas
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Report Header Text Customization
Reply #1 - Oct 25th, 2011 at 10:47am
Print Post  
You can use the Report.Prerender event to accomplish this.

First, assign a name to the label whose text will be customized so that you can identify this label within the event handler:

Code
Select All
<r:Label Name="myLabel" ... /> 


Then, handle the Report.Prerender event and use the following code to change the text:

Code
Select All
if (e.Item.Name == "myLabel")
{
      var border = e.RootVisual as Border;
      var textBlock = border.Child as TextBlock;
      textBlock.Text = "some custom text";
} 


Note, that we are not changing the text of the report label directly. Instead, we change the text of the TextBlock representing the label in the report rendering. Note also, that the RootVisual is a Border element, which contains the actual TextBlock (check RootVisual for additional info).

I hope this helps.

Regards,
Meppy
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint