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

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
 
M

Mick Walker

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
 
P

Polaris

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

Masudur

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top