Setting style properties in datalist depending on DB-content

Discussion in 'ASP .Net Web Controls' started by Jon Henning Bergane, Sep 12, 2003.

  1. 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??
    Jon Henning Bergane, Sep 12, 2003
    #1
    1. Advertising

  2. Jon Henning Bergane

    Slawek Guest

    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" <> wrote in message
    news:25ff01c37935$3a3252f0$...
    > 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??
    >
    >
    Slawek, Sep 12, 2003
    #2
    1. Advertising

  3. 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" <> wrote in message
    >news:25ff01c37935$3a3252f0$...
    >> 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??
    >>
    >>

    >
    >
    >.
    >
    Jon Henning Bergane, Sep 12, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve Lloyd
    Replies:
    1
    Views:
    699
    Rick Spiewak
    May 26, 2004
  2. Nevyn Twyll
    Replies:
    8
    Views:
    1,868
  3. Stuart Shay
    Replies:
    0
    Views:
    406
    Stuart Shay
    Dec 26, 2004
  4. Les Caudle
    Replies:
    0
    Views:
    1,988
    Les Caudle
    May 2, 2006
  5. Wardie
    Replies:
    4
    Views:
    488
    Wardie
    Nov 8, 2006
Loading...

Share This Page