Hi,
I have tried using CodeDomProvider to compile the code on fly and get the value returned, like :
string sEval = "1+1", will always return 2.
However when i try to use the same concept on object like example below, i got an error :
I have a webform with 3 textbox on it, named Label1, Label2, Label3.
Label1.Text = "my first name"
Label2.Text = " my family name"
string sEval = "Label3.Text = Label1.Text + Label2.Text"
now i want to run sEval that will fill Label3.Text = "my first name, my family name".
how to achieve that? please help.
Thanks in advance,
Andy
I have tried using CodeDomProvider to compile the code on fly and get the value returned, like :
string sEval = "1+1", will always return 2.
However when i try to use the same concept on object like example below, i got an error :
I have a webform with 3 textbox on it, named Label1, Label2, Label3.
Label1.Text = "my first name"
Label2.Text = " my family name"
string sEval = "Label3.Text = Label1.Text + Label2.Text"
now i want to run sEval that will fill Label3.Text = "my first name, my family name".
how to achieve that? please help.
Thanks in advance,
Andy
Andy SujotoPosted Aug 22, 2010, 11:24 PM
In your example, is not dynamic. This is what i try to achieve.
I have a program (aspx) that will receive a parameter, based on the parameter, this program will get all required data from
Thanks,
Andy
Andrew FensterPosted Aug 20, 2010, 2:00 PM
protected void Page_Load(object sender, EventArgs e)
{
Label3.Text = Label1.Text + " " + Label2.Text;
}
Or this:
protected void Button1_Click(object sender, EventArgs e)
{
Label3.Text = Label1.Text + " " + Label2.Text;
}
Andy SujotoPosted Aug 19, 2010, 11:53 PM
Can you be more specific? i still don't get what do you try to tell me. put in a little bit full code will be more helpful. Thanks.
Hi Andrew,
I try to issue the command within the page_load event or any click event, also this is just an example, since i still have to load a lot of properties to be set on fly. Is it possible to set it on events ? please enlighten me. thanks.
Andrew FensterPosted Aug 19, 2010, 9:15 PM
Gomathi PalaniswamyPosted Aug 19, 2010, 7:01 AM
Write like
"Label3.Text ="+'"+ Label1.Text +"'+'"+Label1.Text+"'
With Regards,
Gomathi.P