Page 1 of 1

how to pass value to Stimulsoft TextBox

Posted: Thu Oct 18, 2012 8:54 am
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

Re: how to pass value to Stimulsoft TextBox

Posted: Thu Oct 18, 2012 11:07 am
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.

Re: how to pass value to Stimulsoft TextBox

Posted: Sun Nov 11, 2012 8:55 am
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

Re: how to pass value to Stimulsoft TextBox

Posted: Mon Nov 12, 2012 12:17 pm
by HighAley
Hello.

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

Thank you.

Re: how to pass value to Stimulsoft TextBox

Posted: Sun Nov 18, 2012 7:23 am
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

Re: how to pass value to Stimulsoft TextBox

Posted: Mon Nov 19, 2012 7:03 am
by Alex K.
Hello,

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

Thank you.

Re: how to pass value to Stimulsoft TextBox

Posted: Wed Nov 21, 2012 7:44 am
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

Re: how to pass value to Stimulsoft TextBox

Posted: Thu Nov 22, 2012 7:01 am
by Alex K.
Hello,

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

Thank you.

Re: how to pass value to Stimulsoft TextBox

Posted: Thu Nov 22, 2012 8:37 am
by m.issa
Hello

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

Thank you

Re: how to pass value to Stimulsoft TextBox

Posted: Thu Nov 22, 2012 12:47 pm
by Alex K.
Hello,

Ok.