Set html field value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

You can Request.Querystring to get an html field value, how can you set the value from a webform?

thanks,
 
GM,

There are two ways to do this. First, if the code is running on the
server side, then there most likely is an object that represents the field
which you can set the value on.

If you want to set the value on the client side, then you will have to
find the HTML element through Javascript, (through the all collection on the
document most likely).

Hope this helps.
 
I really don't understand your question - but it seems like you're trying to
set values of textboxes, labels,etc from inside code. In that case, you
could write some code

TextBox1.Text = "Some string"
 
Hi,

You question is not very clear, are you trying to set an "initial" value
on a webform control?
if so all you have to do is set the correct property in the code behind:
theTextbox.Text = "This text will appear in the page";

If this is not what you want, give more details about it.

Cheers,
 
Hi,

use it like this:
<INPUT type="hidden" runat="server" id="DueDateHDN" NAME="DueDateHDN">

the runat="server" does the magic
also in the page you have to declare it like this:
protected System.Web.UI.HtmlControls.HtmlInputHidden DueDateHDN;


Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

GM said:
I was talking about html controls found on the html tab like textArea and
Textfield. How can these fields be accessed on the server when placed on a
Webform?
 
but how do you access the information in the input field in the C# code on the server?
You cannot use fieldname.text to get to it...
 
But how can you set the field value on the server? you cannot use fieldname.text = "something";
 
Back
Top