Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Setting style properties in datalist depending on DB-content

Reply
Thread Tools

Setting style properties in datalist depending on DB-content

 
 
Jon Henning Bergane
Guest
Posts: n/a
 
      09-12-2003
Hi newbie here,

Is it possible to set for example the color of some data
in a datalist which is bound to an SQLDatareader
depending on what data is in the current record? Is there
an event where i can read the current db-record and set
the color of the text??


 
Reply With Quote
 
 
 
 
Slawek
Guest
Posts: n/a
 
      09-12-2003
Hi,
There is an event ItemCreated for DataList - You can check every element and
do what you want with it. (using Attributes)

Slawek

"Jon Henning Bergane" <(E-Mail Removed)> wrote in message
news:25ff01c37935$3a3252f0$(E-Mail Removed)...
> Hi newbie here,
>
> Is it possible to set for example the color of some data
> in a datalist which is bound to an SQLDatareader
> depending on what data is in the current record? Is there
> an event where i can read the current db-record and set
> the color of the text??
>
>



 
Reply With Quote
 
 
 
 
Jon Henning Bergane
Guest
Posts: n/a
 
      09-12-2003
So how could this be done here? i want to have
Creationtime in another color.

<asp:datalist id="dlArticles" runat="server" Font-
Names="Verdana" Font-Size="11px">
<ItemTemplate>
<b>
<%# Databinder.Eval
(Container.DataItem, "Creationdatetime", "{0:t}")%>
</b>&nbsp;<a href='article.aspx?RefID=<%#dr
("RefId")%>' target="mainart">
<%#dr("ArticleTitle")%>
</a><br>
</ItemTemplate>
</asp:datalist>

>-----Original Message-----
>Hi,
>There is an event ItemCreated for DataList - You can

check every element and
>do what you want with it. (using Attributes)
>
>Slawek
>
>"Jon Henning Bergane" <(E-Mail Removed)> wrote in message
>news:25ff01c37935$3a3252f0$(E-Mail Removed)...
>> Hi newbie here,
>>
>> Is it possible to set for example the color of some

data
>> in a datalist which is bound to an SQLDatareader
>> depending on what data is in the current record? Is

there
>> an event where i can read the current db-record and set
>> the color of the text??
>>
>>

>
>
>.
>

 
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
Setting properties (not necessarily "Properties") in Java 5.0 Wardie Java 4 11-08-2006 09:46 AM
setting SelectedIndex of DataList nested inside of DataList? Les Caudle ASP .Net 0 05-02-2006 10:44 PM
Setting DataList EditItemTemplate Properties Stuart Shay ASP .Net 0 12-26-2004 05:44 AM
Setting up a datalist control - Item_DataBound for a datalist in a datalist Nevyn Twyll ASP .Net 8 09-09-2004 10:13 PM
Click event in a datalist to post back datalist properties Steve Lloyd ASP .Net 1 05-26-2004 04:07 AM



Advertisments