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

Span vs Label

I am trying to find out why it would be better to use an asp:label vs a span
( <Span ID="FileName" RunAt="Server"/>).

I know that labels get sent as spans, so why not just use the span object?

Just curious.

Thanks,

Tom
Nov 19 '05 #1
5 2102
At client (browser) end, both are porbably the same. But in the regard of
APS.NET developing, Label is a server-side web control and <SPAN /> is not,
even though it is mared as RunAt="Server". Label inherits all
properties/methods/events from System.Web.UI.Control, while <SPAN /> does
not. Functionally, the difference of using them in your ASP.NET page may be
small, the concept is different, even though they may do the almost same
thing.

Actually, you can almost use Html controls only for your ASP.NET page (after
all, all web controls will be rendered to Html thing when sending to
browser), then you will lose all advantages to work with ASP.NET.

"tshad" <ts**********@ftsolutions.com> wrote in message
news:#Y**************@TK2MSFTNGP09.phx.gbl...
I am trying to find out why it would be better to use an asp:label vs a span ( <Span ID="FileName" RunAt="Server"/>).

I know that labels get sent as spans, so why not just use the span object?

Just curious.

Thanks,

Tom

Nov 19 '05 #2
On Fri, 24 Jun 2005 13:18:56 -0500, tshad <ts**********@ftsolutions.com>
wrote:
I am trying to find out why it would be better to use an asp:label vs a
span
( <Span ID="FileName" RunAt="Server"/>).

I know that labels get sent as spans, so why not just use the span
object?

Just curious.

Thanks,

Tom


Mainly because the 'full-fledged' controls like Label provide a richer set
of APIs (events, properties, etc.), than their HTML server control
counterparts. Look through the members of each type in MSDN help; you'll
see the difference.

If you don't need the 'extra' stuff, though, doesn't really matter either
way.

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 19 '05 #3
Actually, the tag would have to be something like this:

<asp:Span ID="FileName" RunAt-"Server" />

In any case, the reason is that people are used to the term 'Label' meaning
a read only fields on their form. To many people 'Span' does not mean
anything, esp. those that are coming from windows or just starting out. But
everyone can understand what a 'Label' is.

Additionally, maybe now the Label is turned into a span. Who knows if it
will always be that way. Maybe some day the 'asp:Label' tag will spit out a
DIV. Or some other new tag. The point is, there is an abstraction between
the actual object, and the details of the implementation of that object.

"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I am trying to find out why it would be better to use an asp:label vs a
span ( <Span ID="FileName" RunAt="Server"/>).

I know that labels get sent as spans, so why not just use the span object?

Just curious.

Thanks,

Tom

Nov 19 '05 #4
there is also a html label (<label>) which should always be used to label
input controls. its required for section 508 (of the Rehabilitation Act)
compliance.

-- bruce (sqlwork.com)
"Marina" <so*****@nospam.com> wrote in message
news:OR**************@tk2msftngp13.phx.gbl...
Actually, the tag would have to be something like this:

<asp:Span ID="FileName" RunAt-"Server" />

In any case, the reason is that people are used to the term 'Label'
meaning a read only fields on their form. To many people 'Span' does not
mean anything, esp. those that are coming from windows or just starting
out. But everyone can understand what a 'Label' is.

Additionally, maybe now the Label is turned into a span. Who knows if it
will always be that way. Maybe some day the 'asp:Label' tag will spit out
a DIV. Or some other new tag. The point is, there is an abstraction
between the actual object, and the details of the implementation of that
object.

"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I am trying to find out why it would be better to use an asp:label vs a
span ( <Span ID="FileName" RunAt="Server"/>).

I know that labels get sent as spans, so why not just use the span
object?

Just curious.

Thanks,

Tom


Nov 19 '05 #5
That abstraction layer also provides for the asp.net engine to be able
to render different tags, depending on what browsers are making
requests.

For example IE might introduce some new functionality that Firefox or
Opera doesn't support. The asp.net engine could analyize the request
and emit the new tags for IE and the older span tags for the others.

JP>

Nov 19 '05 #6

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

Similar topics

1
by: CLS | last post by:
Howdy, How do you write pure text out from a label? I don't want the <span> tags. For example: <script> Owner_FullName.Text = "Lynn Solomon" </script>
1
by: Jeff Thies | last post by:
I have something like this: <span style="width:12ex; text-align: right">field label</span><input type="text" ...> (I suppose it may be better to do that with label. I'm not really sure what...
3
by: madforplaid | last post by:
Can anyone help me to figure out a strange span/radio button/JavaScript behavior? When clicking on the radio button for WEEK 2 below all works okay, but when clicking on the label for the same...
2
by: Andrei Pociu | last post by:
Is there some way to make the label not add a <span> tag? For example I don't need any styles applied or position set so I could as well get rid of <span>. Or is there some other type of control...
2
by: Mike P | last post by:
Is it possible to change the forecolor of a Span programmatically? Cheers, Mike *** Sent via Developersdex http://www.developersdex.com ***
5
by: garthb | last post by:
Hello, I have a site which I've been developing locally with VS2k3 Pro. I have some browsercap information in my web.config to help identify Firefox as an upscale browser. It works great...
7
by: David | last post by:
Hi, I'd really appreciate any help. Im trying to change a label over and over again. I can change it the first time, by using the following code, however it never works again, how can i do this...
4
by: pagates | last post by:
Hello All-- I have a number of <asp:Label CssClass="someclass">Text</asp:Labelcontrols on my page. I would like them to be shown as <div class="someclass">Text</div> rather than <span...
5
by: David Housman | last post by:
Hello, I'm trying to implement a navigation bar with a ul in css. The code is a template, but i'm customizing. I can handle just text in each block, but i want the first block to have an image...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.