HighTechTalks DotNet Forums  

accessing html fields

ASP.net Building Controls microsoft.public.dotnet.framework.aspnet.buildingcontrols


Discuss accessing html fields in the ASP.net Building Controls forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Jessica Weiner
 
Posts: n/a

Default accessing html fields - 07-04-2006 , 07:35 PM






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
  #2  
Old   
ValliM
 
Posts: n/a

Default Re: accessing html fields - 07-05-2006 , 12:56 AM






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" <suspended (AT) gmail (DOT) com> wrote

Quote:
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 Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.