Text element ClickEvent - get line

Stimulsoft Reports.WPF discussion
Post Reply
MasaMM
Posts: 6
Joined: Thu Oct 15, 2015 1:54 pm

Text element ClickEvent - get line

Post by MasaMM »

Hi,

I have a DataBand with a Text element on it. I assigned code to the ClickEvent of this Text. Now I need to know how to get the line of the actual Text the user clicks on.
For example after the report has been generated the DataBand has been printed 3 times - so has the Text element on my DataBand. I just need to know on which of those 3 printet texts raised the click event (by giving me the line number or even the actual data record for this line)
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Text element ClickEvent - get line

Post by HighAley »

Hello

You could get text of the Text component with next code:

Code: Select all

(sender as StiText).Text.Value
If you need to get any additional data. You could store it in Tag property of the Text component.

Thank you.
MasaMM
Posts: 6
Joined: Thu Oct 15, 2015 1:54 pm

Re: Text element ClickEvent - get line

Post by MasaMM »

Aleksey Andreyanov wrote: If you need to get any additional data. You could store it in Tag property of the Text component.
Hello,

The Tag property seems to be the same for every instance of the Text element. So I can't have different Tag data for different instances of my Text.
In contrast to the "Text" property of the Text element which returns the Text of the rendered instance of the Text element rather than the expression.

(There's far too much "text" going on above :mrgreen: )
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Text element ClickEvent - get line

Post by HighAley »

Hello.

Each instance of Text component have it's own Tag property. You could see how to set Tag value in the Interactive Reports - Anchors demo report. Look at Text28 text component.

To get the value of Tag you could use next expression:

Code: Select all

(sender as StiText).TagValue
Thank you.
MasaMM
Posts: 6
Joined: Thu Oct 15, 2015 1:54 pm

Re: Text element ClickEvent - get line

Post by MasaMM »

Thanks, that worked! :)
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Text element ClickEvent - get line

Post by HighAley »

Hello.

We are always glad to help you.
Let us know if you need any additional help.

Thank you.
Post Reply