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

Why do labels have .DataBind ?

Roy
This may seem silly, but I'm just curious...

I've noticed that in the code-behind, asp:Label has the .DataBind
property yet has NO corresponding .DataSource property? Am I missing
something? How can you databind something that has no datasource?

Thanks

*** Sent via Developersdex http://www.developersdex.com ***
Mar 7 '06 #1
2 1006
It's inherited from the Control class.

HTH,
Darren Kopp
http://blog.secudocs.com/

Mar 7 '06 #2
You don't have to have DataSource in order to databind. All you need is to
use a databind expression for any of the control's properties. Example:

<asp:label ... Text='<%# CurrentDateString %>' ...

where CurrentDateString is a property you are binding your Text property to.
To get Text actually populated, you need to call the DataBind method.

Eliyahu

"Roy" <SP*******@gmail.com> wrote in message
news:ul**************@TK2MSFTNGP09.phx.gbl...
This may seem silly, but I'm just curious...

I've noticed that in the code-behind, asp:Label has the .DataBind
property yet has NO corresponding .DataSource property? Am I missing
something? How can you databind something that has no datasource?

Thanks

*** Sent via Developersdex http://www.developersdex.com ***

Mar 8 '06 #3

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

Similar topics

0
by: autofill | last post by:
2 scenario inside a WebUserControl. I want to know why Microsoft and so many book doesn't suggest us to work like that. This control going to be in my page and I will call the DataBind of my...
2
by: DBQueen | last post by:
I have a database which will be printing out labels for SMALL test tubes (1/4" high). We have yet to find a reasonably-priced printer (labelwriter) which can effectively print this on ROLLS of...
6
by: DebbieG | last post by:
I am creating a database for a small department in a university. Each student in their database can have 2 mailing addresses. They wanted mailing labels pulling just the 1st address. No problem....
3
by: Grim Reaper | last post by:
I print mailing labels out of Access 2000 databases about 3 to 4 times a week. I have been having problems with one thing since I have been printing mailing labels. I print mailing labels by...
3
by: Grim Reaper | last post by:
I know this is probably an easy question, but I could not find/figure it out. Basically, I am printing mailing labels with a "Sorting/Grouping" section that groups the label types together....
3
by: Marty McDonald | last post by:
I have <asp:Table... </asp:Table> on my webform. In codebehind, I populate a DataTable whose data should appear in the asp:Table. I created my own code to populate the asp:Table with the...
6
by: Ron | last post by:
Hi, I know Access allows for easy construction of a report setup to print labels from a table/query, etc. I've done that one. It works pretty well for what I need. However, is there an...
2
by: Steve Hershoff | last post by:
Hi everybody, I have a question about asp.net's labels and the DataBind method. I have a method in a code-behind page (this is VisualStudio 2003 btw) that (simplified) looks like this: ...
0
by: xikom01 | last post by:
In this age, there is a lot of focus on the importance of "getting organized." There are even professional organizers for hire! Labels are a huge presence in the field of organization, because they...
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
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...
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
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...
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...

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.