472,142 Members | 1,046 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,142 software developers and data experts.

Set html field value

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

thanks,

Nov 16 '05 #1
7 4848
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.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"GM" <GM@discussions.microsoft.com> wrote in message
news:6C**********************************@microsof t.com...
You can Request.Querystring to get an html field value, how can you set the value from a webform?
thanks,

Nov 16 '05 #2

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"

--
Sriram Krishnan
Microsoft Student Ambassador
http://www.dotnetjunkies.com/weblog/sriram
"GM" <GM@discussions.microsoft.com> wrote in message
news:6C**********************************@microsof t.com...
You can Request.Querystring to get an html field value, how can you set the value from a webform?
thanks,

Nov 16 '05 #3
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,

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

"GM" <GM@discussions.microsoft.com> wrote in message
news:6C**********************************@microsof t.com...
You can Request.Querystring to get an html field value, how can you set the value from a webform?
thanks,

Nov 16 '05 #4
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" <GM@discussions.microsoft.com> wrote in message
news:BA**********************************@microsof t.com...
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?
thanks,
"GM" wrote:
You can Request.Querystring to get an html field value, how can you set the value from a webform?
thanks,

Nov 16 '05 #5
GM
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...

"Ignacio Machin ( .NET/ C# MVP )" wrote:
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" <GM@discussions.microsoft.com> wrote in message
news:BA**********************************@microsof t.com...
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?

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


Nov 16 '05 #6
GM
But how can you set the field value on the server? you cannot use fieldname.text = "something";

"Ignacio Machin ( .NET/ C# MVP )" wrote:
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" <GM@discussions.microsoft.com> wrote in message
news:BA**********************************@microsof t.com...
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?

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


Nov 16 '05 #7
why not?

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"GM" <GM@discussions.microsoft.com> wrote in message
news:6F**********************************@microsof t.com...
But how can you set the field value on the server? you cannot use fieldname.text = "something";


"Ignacio Machin ( .NET/ C# MVP )" wrote:
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" <GM@discussions.microsoft.com> wrote in message
news:BA**********************************@microsof t.com...
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?

thanks,
"GM" wrote:

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


Nov 16 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Gary | last post: by
4 posts views Thread by Andrew Williams | last post: by
3 posts views Thread by hugo | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.