Change the StiText Component value

Stimulsoft Reports.WEB discussion
Post Reply
thiagoz
Posts: 3
Joined: Tue Jun 30, 2015 2:45 pm

Change the StiText Component value

Post by thiagoz »

Hi!!

I need to change the text value of a Text component in run time mode. I tried a lot ways to do it, but no success.

None of ways below works:

SistemaConsorcio si = new SistemaConsorcio();

((Stimulsoft.Report.Components.StiText)si.GetComponentByName("lblReportConsorcio")).Text = "System";
si.lblReportConsorcio.Text.Value = "System";
si.lblReportConsorcio.TextValue = "System";

Thank you for your help!!!
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Change the StiText Component value

Post by HighAley »

Hello.

Here is a sample code how to change text value at runtime:

Code: Select all

            StiText txt = report.GetComponentByName("Text1") as StiText;
            txt.GetValue += new Stimulsoft.Report.Events.StiGetValueEventHandler(txt_GetValue);
            
        ...

        void txt_GetValue(object sender, Stimulsoft.Report.Events.StiGetValueEventArgs e)
        {
            e.Value = "System";
        }
Other way is to add a variable, use the variable in text component and change value of the variable at runtime.

Thank you.
Post Reply