Setting style properties in datalist depending on DB-content

  • Thread starter Jon Henning Bergane
  • Start date
J

Jon Henning Bergane

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??
 
S

Slawek

Hi,
There is an event ItemCreated for DataList - You can check every element and
do what you want with it. (using Attributes)

Slawek
 
J

Jon Henning Bergane

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top