473,395 Members | 1,495 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Accessing input fields declared outside the form

I have an input field defined outside the <formarea. 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
Jul 4 '06 #1
2 3174
1. some people consider it bad form to post to more than one newgroup
:)

2. why is this input field outside of the form?

cheers

neil
Jessica Weiner wrote:
I have an input field defined outside the <formarea. 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
Jul 5 '06 #2

Jessica Weiner wrote:
I have an input field defined outside the <formarea. Its a simple html
text input that is used to enter the number of hours.
<input id="HoursField" name="hours" type="text" />
don't declare it outside the form tag.
use
<input id="hoursfield" name="hours" type="text" runat="server">

and then use it in script tags
like
string hours="";
hours=hoursfield.text;

Jul 5 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Emanuel Marciniak | last post by:
Hi all, We have the form which uses checkboxes for several fields and the target action points to outside webservice. Unfortunatelly they do not support checkboxes. How to pass it as a radio...
2
by: Christopher Johannsen | last post by:
Good Day: I am working on building a tool Using ASP/COM & IIS5.1 for a non-administrative technical support team to change domain passwords for users. I have the basic interface built and...
7
by: Koda | last post by:
What is the difference between class fields and class properties? Thanks Mike
2
by: Parveen | last post by:
I have a data grid on a windows form that I want to access from another class that's outside the form but in the same project. This other class stores all methods that populate and modify the grid...
5
by: stellstarin | last post by:
I have a html where fields are created and added dynamically on the client side. I use the AppendChild() call to create fields dynamically. On submit i try to get the value for all the...
12
by: Steve Blinkhorn | last post by:
Does anyone know of a way of accessing and modifying variables declared static within a function from outside that function? Please no homilies on why it's bad practice: the context is very...
3
by: tshad | last post by:
I am trying to put together a user control (.ascx). Can you access an outside control from it? My control: login2.ascx ****************************************************************...
2
by: Jessica Weiner | last post by:
I have an input field defined outside the <formarea. 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...
7
by: Chuck Anderson | last post by:
I'm pretty much a JavaScript novice. I'm good at learning by example and changing those examples to suit my needs. That said .... ..... I have some select fields in a form I created for a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.