473,588 Members | 2,460 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TextBox Style Like Label?


How can I style a TextBox so it appears like a label when rendered?

Thanks.
Nov 19 '05 #1
2 6536
"localhost" <pr*******@coho rt.ces> wrote in message
news:s3******** *************** *********@4ax.c om...

How can I style a TextBox so it appears like a label when rendered?


I don't think you can. A TextBox and a Label are two different things. A
Label renders "like a label" not because of its styles, but because the
Label control renders as a <span/> element. A TextBox renders as a text box
because it renders as a <input type="text"> element.

John Saunders
Nov 19 '05 #2
I have used CSS to accomplish the reverse (make a label appear like a
textbox) but it should be easily done using CSS, something similar to
below perhaps:

/* Works for all textboxes */
input {
border: none;
background-color: <page background color>
}

/* Works for textboxes with a class of label
input.label {
<same as above>
}

I tested this briefly on my development machine and it works like a
charm.

John Saunders wrote:
"localhost" <pr*******@coho rt.ces> wrote in message
news:s3******** *************** *********@4ax.c om...

How can I style a TextBox so it appears like a label when rendered?


I don't think you can. A TextBox and a Label are two different
things. A Label renders "like a label" not because of its styles, but
because the Label control renders as a <span/> element. A TextBox
renders as a text box because it renders as a <input type="text">
element.

John Saunders


Nov 19 '05 #3

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

Similar topics

4
2900
by: Rodrigo DeJuana | last post by:
Howdy, I'm new to this .net stuff and really have little to no training. Im trying to create a new page for a web form, so i have been pretty much jsut coping code. I having some issue with some textboxes not updating when i a hit save. for example I have this code in my aspx.cs file: declared:
1
3010
by: Shilpi Chaudhry | last post by:
I have a forloop which I use to create textboxes - but unfortunately all of them have the same ids - I need to assign different ids to these textboxes creeated in the loop so that I can retrieve their corrs values. Anybody?? Code snippet: <% int y = 7; %>
7
4618
by: Sandy | last post by:
Hello - I have a form that when submitted checks the database and if the username is already taken, a label shows indicating same. I need to make that label NOT visible after the user clicks in the username textbox to change the name. Any help will be greatly appreciated!
2
5601
by: aarepasky | last post by:
I am using ASP Web 2005 express and I have a textbox in a user control. Now when I try to use it in another user control, I get the error that it "does not exist in current context. These 2 user controls are each in a panel on the page. riprip
10
1767
by: aarepasky | last post by:
I am using ASP Web 2005 express. I created the user control below and I am listing the html code. I have 2 textboxes. One is txtCompanyName. The main page has 2 panels on it and a button. Panel1 contains the user control1 which is a form that has the txtCompanyName. Panel2 contains another user control2 which is another form. When I click the button, I want to do something with the textbox
0
2390
by: Jacob Donajkowski | last post by:
Once the user logs in I want to have the users switch from the Roster View to the Profile View and enter their profile infomation and save it. Then the next time they login and go to the Profile View I want the form populated from there profile on the sql server. The code to save the profile works fine. But when the user logs back in they data doesn't load back to the form. The multiview is located inside the LoginView's Logged-In View ....
0
3489
by: sjickells | last post by:
Hi I am having a problem using asp:TextBox's in a transparent table. I have a background image on the page and a table in the middle of the page. I have set the background colour of the table to white the used CSS to set the opacity to 90 so that you can see the background image through the table. The problem I am having is with the textboxes in the transparent
0
2526
KalariaNitya
by: KalariaNitya | last post by:
Hello, could anybody help me? i have gridview, inside gridview i have one Update button & textbox update button update the quantity entered in textbox. i want to update the quantity on textbox on ENTER event. i had done below code: page_load()
2
12869
by: mrutyunjaya | last post by:
hello, i have two textbox column and one button control in gridvie when i click button it will ask plese enter price in first textbox . when enter values it is asking again. how to pass textboxid in javascript .my code is function validation() { alert("hi")
0
7929
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7860
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8222
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8354
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7984
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5398
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3847
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1458
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1195
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.