Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > accessing html fields

Reply
Thread Tools

accessing html fields

 
 
Jessica Weiner
Guest
Posts: n/a
 
      07-04-2006
I have an input field defined outside the <form> area. Its a simple html
text input that is used to enter the number of hours.

<input id="HoursField" name="hours" type="text" />

I want to access this field from the server side (c# code). I tried these
two methods to access the field but they dont work. Please help.

String[] tempArray;
tempArray = Request.Form.GetValues("hours");
Response.Write (tempArray[0]);

---

string val = Request.QueryString["hours"].ToString();
Response.Write (val);


Jessica


 
Reply With Quote
 
 
 
 
ValliM
Guest
Posts: n/a
 
      07-05-2006
Hi Jessica,

To access the html control in the server side we have to include the
property runat="server" in the input tag,

<input id="HoursField" name="hours" runat="server" type="text"
value="60:00"/>

In the C# code you can access the HoursField by using the code

Response.Write(HoursField.Value);

Regards,

Valli.

www.syncfusion.com

"Jessica Weiner" <(E-Mail Removed)> wrote in message
news:YWCqg.126763$(E-Mail Removed) .com...
>I have an input field defined outside the <form> area. Its a simple html
>text input that is used to enter the number of hours.
>
> <input id="HoursField" name="hours" type="text" />
>
> I want to access this field from the server side (c# code). I tried these
> two methods to access the field but they dont work. Please help.
>
> String[] tempArray;
> tempArray = Request.Form.GetValues("hours");
> Response.Write (tempArray[0]);
>
> ---
>
> string val = Request.QueryString["hours"].ToString();
> Response.Write (val);
>
>
> Jessica
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
epydoc: How to add new fields as the building fields? Cyril.Liu Python 0 12-02-2008 05:01 AM
print struct fields and its member structs' fields recursively, generically call_me_anything C++ 4 09-30-2007 10:12 PM
accessing html input fields Jessica Weiner Javascript 2 07-05-2006 10:00 AM
accessing html fields Jessica Weiner ASP .Net Web Services 1 07-05-2006 03:08 AM
how to copy from fields to other fields middletree ASP General 1 11-05-2003 06:24 PM



Advertisments