how to pass value to Stimulsoft TextBox

Stimulsoft Reports.WEB discussion
Post Reply
m.issa
Posts: 27
Joined: Tue Sep 04, 2012 8:08 am

how to pass value to Stimulsoft TextBox

Post by m.issa »

Hello all

how i can pass value from C# web application into stimulsoft TextBox ---> Text2

i think the code in C# will be something like that:
report.Designer["Text2"].Value = "admin";

thank you
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: how to pass value to Stimulsoft TextBox

Post by HighAley »

Hello.

Please, read the 11.3 How to find a component by its name? section of the Stimulsoft Reports.Net Developer FAQ.
Your could should look like:

Code: Select all

(report.GetComponentByName("Text2") as StiText).Text = "admin";
Thank you.
m.issa
Posts: 27
Joined: Tue Sep 04, 2012 8:08 am

Re: how to pass value to Stimulsoft TextBox

Post by m.issa »

Hello

i wrote this line:

Code: Select all

(report.GetComponentByName("Text51") as StiText).Text = "admin";
but when the report display the TextBox51 came empty!!

i am using 2012.2 version

thank you
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: how to pass value to Stimulsoft TextBox

Post by HighAley »

Hello.

We need to see a full code of the method where you tries to change Text.

Thank you.
m.issa
Posts: 27
Joined: Tue Sep 04, 2012 8:08 am

Re: how to pass value to Stimulsoft TextBox

Post by m.issa »

Hello

this is part of my code:

Code: Select all

 StiReport report = new StiReport();
        report.LoadFromString(a);
        report.GetSubReport += new StiGetSubReportEventHandler(rep_GetSubReport);
        report.Compile();

        if (!string.IsNullOrEmpty(ReportParameters.Permissions))
        {
            report["Permission"] = ReportParameters.Permissions;
            if (Request.QueryString["RepID"] != null)
                (report.GetComponentByName("Text51") as StiText).Text = usrName;
        }

        eport.Render();
        StiWebViewerFx1.Report = report;
Thank you
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: how to pass value to Stimulsoft TextBox

Post by Alex K. »

Hello,

Please try to use the following code before Compile() method:
(report.GetComponentByName("Text51") as StiText).Text = usrName;

Thank you.
m.issa
Posts: 27
Joined: Tue Sep 04, 2012 8:08 am

Re: how to pass value to Stimulsoft TextBox

Post by m.issa »

this is my T-Query inside my report

Code: Select all

SELECT DISTINCT PName, Substring(MnuText, 2, LEN(MnuText)) AS MnuTextEn FROM 

(
SELECT
	[InnerData].MnuParentID,[InnerData].MnuVisible,[InnerData].MnuType,[InnerData].MnuPermissionID,
	(select MnuTextEn from Menu where MnuType = 'SubMenu' and [InnerData].MnuParentID = MnuPermissionID) as PName,
        
(SELECT  '-' + MnuTextEn FROM Menu WHERE MnuParentID=[InnerData].MnuParentID FOR XML PATH('')) AS MnuText

        FROM
        (
SELECT DISTINCT MnuParentID, MnuVisible, MnuType,MnuPermissionID  FROM Menu
            
        ) AS [InnerData] 
) AS OuterData where OuterData.MnuVisible = 'True' and OuterData.MnuType = 'Command' and OuterData.MnuParentID IN({Permission})
if i put Compile method before (report.GetComponentByName("Text51") as StiText).Text = "admin"; the report run and i got all data inside it except the value that i pass to TextBox in the previous line.

if i put Compile method after (report.GetComponentByName("Text51") as StiText).Text = "admin"; that generated the following error:
(Incorrect syntax near ')'.), although as i said if i put compile method before that line of code it is running properly.

thank you
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: how to pass value to Stimulsoft TextBox

Post by Alex K. »

Hello,

Can you please send us a sample project which reproduce the issue for analysis.

Thank you.
m.issa
Posts: 27
Joined: Tue Sep 04, 2012 8:08 am

Re: how to pass value to Stimulsoft TextBox

Post by m.issa »

Hello

i will try to prepare sample project as soon as possible.

Thank you
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: how to pass value to Stimulsoft TextBox

Post by Alex K. »

Hello,

Ok.
Post Reply