我如何将C#web应用程序中的值传递给stimulsoft文本框 [英] How I can pass value from C# web application into stimulsoft textbox
问题描述
hi
请帮我解决这个问题:
如何将C#web应用程序的值传递给stimulsoft TextBox:
我的代码:
hi
please help me about this problem:
how i can pass value from C# web application into stimulsoft TextBox:
my code :
protected void Page_Load(object sender, EventArgs e)
{
this.txt_egample.Text = Decrypt(Request.QueryString["eg"]);
this.txt_sh_p.Text = Decrypt(Request.QueryString["sh_p"]);
this.txt_radif_mahkom.Text = Decrypt(Request.QueryString["radif_mah"]);
this.txt_radif_dad.Text = Decrypt(Request.QueryString["radif_dad"]);
StiWebViewer1.Visible = true;
string ConnectionString = ConfigurationManager.ConnectionStrings["Database_ejraConnectionString"].ConnectionString;
string serverlocation = HttpContext.Current.Server.MapPath(string.Empty);
StiReport myreport = new StiReport();
StiText txt = new StiText();
myreport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Coneection", ConnectionString));
txt = (StiText)myreport.GetComponentByName("Text5");
txt.Text = txt_egample.Text;
myreport.Load(serverlocation + "\\rep\\Report2.mrt");
myreport.Dictionary.Variables["sh_par"].Value = txt_sh_p.Text;
myreport.Dictionary.Variables["rad"].Value = txt_radif_mahkom.Text;
myreport.Dictionary.Variables["rad_dad"].Value = txt_radif_dad.Text;
StiWebViewer1.Report = myreport;
}
i try above code but this error display on this line:
Object reference not set to an instance of an object.
txt.Text = txt_egample.Text;
谢谢
我的尝试:
i尝试上面的代码,但此错误显示在此行:
对象引用未设置为对象的实例。 />
txt.Text = txt_egample.Text;
thanks
What I have tried:
i try above code but this error display on this line:
Object reference not set to an instance of an object.
txt.Text = txt_egample.Text;
推荐答案
错误消息表明txt
或txt_egample
是NULL
。
如果这里没有名为Text5的组件,我猜是txt
:
The error message indicates that eithertxt
ortxt_egample
isNULL
.
I guess it istxt
when there is no component named "Text5" here:
txt = (StiText)myreport.GetComponentByName("Text5")
分配后,你也分配给 txt
code> StiText 这里的实例,以便永远不会使用此实例:
You are also assigning to txt
after you have allocated an StiText
instance here so that this instance is never used:
StiText txt = new StiText();
我不知道StimulSoft,但似乎你可以使用
I don't know StimulSoft but it seems you can just use
StiText txt = (StiText)myreport.GetComponentByName("Text5")
并省略分配。但你仍然应该检查 txt
是否有效(非空)。
对不起,我忘了你要设置文字。
有一个 SetText
功能:
and omit the allocation. But you should still check if txt
is valid (not empty).
Sorry, I forget that you want to set the text.
There is a SetText
function:
StiText txt = (StiText)myreport.GetComponentByName("Text5");
txt.SetText(txt_egample.Text);
[/ EDIT]
[/EDIT]
这篇关于我如何将C#web应用程序中的值传递给stimulsoft文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!