473,396 Members | 1,775 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,396 software developers and data experts.

Difference between using a hidden field and a label that is not visible.

Is there any real difference between using a hidden field and using a label
that is not visible. My thought being that I could leave the labels visible
while testing but make them invisible once I'm done. This way I can see what
is actually being stored in the values.

TIA - Jeff.
Dec 21 '07 #1
3 4149
I think that a hidden label will not actually render anything to the client,
whereas a hidden form field will.
"Mufasa" <jb@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Is there any real difference between using a hidden field and using a
label that is not visible. My thought being that I could leave the labels
visible while testing but make them invisible once I'm done. This way I
can see what is actually being stored in the values.

TIA - Jeff.


Dec 21 '07 #2
"Mufasa" <jb@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Is there any real difference between using a hidden field and using a
label that is not visible. My thought being that I could leave the labels
visible while testing but make them invisible once I'm done. This way I
can see what is actually being stored in the values.
When you say "not visible", presumably you are talking about hiding the
label with a CSS style - if you use an <asp:Labelcontrol and set its
Visible property to false, it won't even get rendered to the client...

I would advise you to use hidden fields for this, and set breakpoints in
your code to inspect their values - you can always do a View Source once the
page has been rendered to the client...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Dec 21 '07 #3

"Mufasa" <jb@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Is there any real difference between using a hidden field and using a
label that is not visible. My thought being that I could leave the labels
visible while testing but make them invisible once I'm done. This way I
can see what is actually being stored in the values.

TIA - Jeff.

A couple of difference off the top of my head:

1. Hidden fields can be set client-side with javascript. I'm not aware of a
way to do that with labels. Especially not invisible labels (see 3).

2. Hidden field values are sent to the server as part of the POST data,
which makes them useful for cross-page postbacks.

3. Labels that are not "visible" are not rendered to the browser, hidden
fields are. Well, they're not rendered as HTML, they are in the viewstate
though.

Just curious, what is the point of storing values in invisible labels?

Dec 21 '07 #4

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

Similar topics

1
by: mark.reichman | last post by:
First off.. Thanks to Grant Wagner for help in a previous thread related to this one. I am at a total loss... I have multiple fields in a form with the same name. Lets call the fields with the...
2
by: Boonaap | last post by:
two labels, one with a list of input controls, and another with a datagrid depending on which button is clicked, one of the labels is put visible, the other one is put hidden with a css class like...
4
by: Nicky | last post by:
hi, all I got another quesiton, in my DataGrid control, I want to have a hidden column which will contian an ID value, I don't want to display this ID value to user, but I need it when user click...
1
by: ratnakarp | last post by:
Hi, I have a search text box. The user enters the value in the text box and click on enter button. In code behind on button click i'm writing the code to get the values from the database and...
15
by: Swetha | last post by:
Hello I have a DropDownList that I am populating using the following SqlDataSource: <asp:DropDownList ID="parentIDDropDownList" runat="server" DataSourceID="SqlDataSource3"...
0
by: Keith | last post by:
I have a web form that contains a repeater control that is designed to ask like a check book register. Clicking on a certain transaction takes the user to a different .aspx page where it can be...
0
by: Keith | last post by:
I have a web form that contains a repeater control that is designed to ask like a check book register. Clicking on a certain transaction takes the user to a different .aspx page where it can be...
4
by: =?Utf-8?B?QmFidU1hbg==?= | last post by:
Hi, I have a GridView and a SqlDataSource controls on a page. The SqlDataSource object uses stored procedures to do the CRUD operations. The DataSource has three columns one of which -...
1
by: crazyhouse | last post by:
Ok, so i looked up the information that i needed, but now I see that what i was trying to do was really made for a SQL statement. Here is what happens. I open a form (hidden) with 20+ fields on...
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:
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.