Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Why do labels have .DataBind ?

Reply
Thread Tools

Why do labels have .DataBind ?

 
 
Roy
Guest
Posts: n/a
 
      03-07-2006
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 ***
 
Reply With Quote
 
 
 
 
Darren Kopp
Guest
Posts: n/a
 
      03-07-2006
It's inherited from the Control class.

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

 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      03-08-2006
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" <(E-Mail Removed)> wrote in message
news:ulvI1$(E-Mail Removed)...
> 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 ***



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"pointlabel"-like function for Python: distribute text labels on a2-d scatter plot to avoid overlapping labels C Barrington-Leigh Python 1 09-12-2010 09:58 PM
why why why why why Mr. SweatyFinger ASP .Net 4 12-21-2006 01:15 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
Record Labels May Have to Pay Double Royalties Lennier NZ Computing 7 01-14-2004 08:49 PM



Advertisments