Hi,
You can get the functionality in ASP.NET ( it does not matter if in Vb.net
or C# ) but no using an "eval" feature, .NET languages ( not sure for
jscript ) are compiled languages meaning that you cannot "evaluate" an
expression at runtime. That's a big difference between a compiled language
and a interpreted one.
The feature that let you do that in ASP.NET is cause all the controls in the
page are referenced in a collection, named Controls , now it turns out that
each control has a string property named Name that contain the name of the
control, this is assigned by the page parser when the page is first
compiled.
Therefore to get a reference to a control you can do this:
Controls.Find( "control_name");
This return a Control instance which you must cast it back to the correct
type:
TextBox tb = ( TextBox) Controls.Find( "control_name");
tb.Text = "asdfaf";
Hope this help,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"ChAnGePoInT_DaWg" <Su*******@RichMan.Diu> wrote in message
news:E5**********@twister01.bloor.is.net.cable.rog ers.com...
Is there an "eval" function in C#? Here is what I want to do:
I have a lot of controls like this:
<asp:textbox id="books_quantity" runat="server"/>
<asp:textbox id="vcds_quantity" runat="server"/>
<asp:textbox id="dvds_quantity" runat="server"/>
In my script, I want to refer to the names dynamically like this:
eval("books" + "_quantity").Text = 100;
Is it possible in C#? Because in PHP, Javascript.. they all can do this.
Help..