Hello,
What control should I use when displaying some text? A Literal or a
Label?
Considerer I want to display some text and apply a CSS class to it.
I can do it in 2 ways:
MyLabel.CssClass = "MyClass"
MyLabel.Text = "My Text"
Or using a Literal
MyLiteral.Text = "<p class=""MyClass"">My Text</p>"
Which approach should I use?
I know Asp:Label is good for placing before a TextBox.
However in the situation I explained in this message I don't know which
one should I use.
Could someone, please, help me out with this?
Thanks,
Miguel 4 1532
"shapper" <md*****@gmail.comwrote in message
news:11**********************@k70g2000cwa.googlegr oups.com...
Could someone, please, help me out with this?
Try both and inspect the HTML that ASP.NET outputs...
I really don't think it will make much difference in the grand scheme of
things...
Good OOP hides complexity. Imagine you have 100 Labels on a page. Now,
imagine you have 100 LiteralControls on your page. Which is easier for you
to read and work on?
--
HTH,
Kevin Spencer
Microsoft MVP
Software Composer http://unclechutney.blogspot.com
A watched clock never boils.
"shapper" <md*****@gmail.comwrote in message
news:11**********************@k70g2000cwa.googlegr oups.com...
Hello,
What control should I use when displaying some text? A Literal or a
Label?
Considerer I want to display some text and apply a CSS class to it.
I can do it in 2 ways:
MyLabel.CssClass = "MyClass"
MyLabel.Text = "My Text"
Or using a Literal
MyLiteral.Text = "<p class=""MyClass"">My Text</p>"
Which approach should I use?
I know Asp:Label is good for placing before a TextBox.
However in the situation I explained in this message I don't know which
one should I use.
Could someone, please, help me out with this?
Thanks,
Miguel
In my opinion, the Label. Because of CSS and SkinID.
I will be able to change everything in a moment.
But this is my opinion.
Kevin Spencer wrote:
Good OOP hides complexity. Imagine you have 100 Labels on a page. Now,
imagine you have 100 LiteralControls on your page. Which is easier for you
to read and work on?
--
HTH,
Kevin Spencer
Microsoft MVP
Software Composer http://unclechutney.blogspot.com
A watched clock never boils.
"shapper" <md*****@gmail.comwrote in message
news:11**********************@k70g2000cwa.googlegr oups.com...
Hello,
What control should I use when displaying some text? A Literal or a
Label?
Considerer I want to display some text and apply a CSS class to it.
I can do it in 2 ways:
MyLabel.CssClass = "MyClass"
MyLabel.Text = "My Text"
Or using a Literal
MyLiteral.Text = "<p class=""MyClass"">My Text</p>"
Which approach should I use?
I know Asp:Label is good for placing before a TextBox.
However in the situation I explained in this message I don't know which
one should I use.
Could someone, please, help me out with this?
Thanks,
Miguel
I would agree with you! And I'm not at all certain that this is simply a
matter of opinion!
--
HTH,
Kevin Spencer
Microsoft MVP
Software Composer http://unclechutney.blogspot.com
A watched clock never boils.
"shapper" <md*****@gmail.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
In my opinion, the Label. Because of CSS and SkinID.
I will be able to change everything in a moment.
But this is my opinion.
Kevin Spencer wrote:
>Good OOP hides complexity. Imagine you have 100 Labels on a page. Now, imagine you have 100 LiteralControls on your page. Which is easier for you to read and work on?
-- HTH,
Kevin Spencer Microsoft MVP Software Composer http://unclechutney.blogspot.com
A watched clock never boils.
"shapper" <md*****@gmail.comwrote in message news:11**********************@k70g2000cwa.googleg roups.com...
Hello,
What control should I use when displaying some text? A Literal or a
Label?
Considerer I want to display some text and apply a CSS class to it.
I can do it in 2 ways:
MyLabel.CssClass = "MyClass"
MyLabel.Text = "My Text"
Or using a Literal
MyLiteral.Text = "<p class=""MyClass"">My Text</p>"
Which approach should I use?
I know Asp:Label is good for placing before a TextBox.
However in the situation I explained in this message I don't know which
one should I use.
Could someone, please, help me out with this?
Thanks,
Miguel This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: SysSpider |
last post by:
Hi again,
This is my problem: when i try to compile the code that contains the
function below, i get this:
--
gcc:21: error: case label does not reduce to an integer constant
gcc:24: error:...
|
by: NancyASAP |
last post by:
I have a label on my ASP.NET form. It has a cssclass that includes a
background color.
I am dynamically putting text in this label. The text contains some
embedded html (I want to display part...
|
by: Joe |
last post by:
I know that the Literal control will not render a <span> tag so I can not
format its text. Other than this, what is the difference betwen the Literal
control and the LiteralControl Control? How...
|
by: David Thielen |
last post by:
We have a status message we display that can be good news (in green) or bad
news (in red). Is there a way to do this for a single literal or label? Or do
we need to have two, one set to green and...
|
by: David Thielen |
last post by:
Hi;
I have some error messages I have to create (can't use the validators). I
have done this using both labels and literals - is there any reason to prefer
one over the other?
Note: We are...
|
by: Xah Lee |
last post by:
Tabs versus Spaces in Source Code
Xah Lee, 2006-05-13
In coding a computer program, there's often the choices of tabs or
spaces for code indentation. There is a large amount of confusion about...
|
by: ASP Developer |
last post by:
I have a variety of pages that use a master page. For some reason when I
attempt to copy any of the label text on the screen it seems to highlight
most of the screen randomly and I can't simply...
|
by: versus |
last post by:
Hi
I have a table column that has multiple lines (\r\n) and html tags in it. I
want to display it in a div and label that html tags can be seen and
newlines should work.
If i use div.innerHTML...
|
by: Brian Simmons |
last post by:
I'll try to keep this short & sweet and hopefully get the direction I'm
looking for.
I'll drop a SqlDatasource onto a webform. Configure it to use a stored
proc, perhaps have the parameters be...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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...
|
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: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
| |