How to set a value into a HTML input box in ASP.NET?

  • Thread starter Thread starter Polaris
  • Start date Start date
P

Polaris

Hi Experts:

I'm using ASP.NET 2.0 (C#). I need to do something a bit unusual:

There is a hidden HTML input field (text box) and I need to programmatically
set some value into it. How can I do it? Please be specific if possible.

Thanks in Advance!

Polaris
 
Polaris said:
Hi Experts:

I'm using ASP.NET 2.0 (C#). I need to do something a bit unusual:

There is a hidden HTML input field (text box) and I need to programmatically
set some value into it. How can I do it? Please be specific if possible.

Thanks in Advance!

Polaris
Just set its runat attribute to runat="server" and you can set its value
from your code behind, simply by selecting Control.Value

Regards
Mick
 
Sorry, forgot to mention that I could not use the runat="server" attribute
for this input box. Is there other ways to do it?
 
Sorry, forgot to mention that I could not use the runat="server" attribute
for this input box. Is there other ways to do it?

Hi...

Since you can not use runat server...
you got to use javascript or some thing like that...
well just use.
Page.RegisterStartupScript or
Page.RegisterClientScriptBlock to inject a script which
will set the value of the hidden textbox

Thanks
Masudur
http://munnacs.110mb.com
 
Back
Top