Style changes based upon Data Values

Discussion in 'ASP .Net' started by =?Utf-8?B?ZTJiaXo=?=, Nov 8, 2005.

  1. I want to change the style of a data presented based upon the value of the
    data. For example, I if the value is positive I want it to appear black but
    if it is negative I want it to be red. Any suggestions would be helpful!

    --
    Rob
    =?Utf-8?B?ZTJiaXo=?=, Nov 8, 2005
    #1
    1. Advertising

  2. Just bind style or property you want.. I do not know your code but adding a
    binding like this should do what u want.

    ((Decimal)DataBinder.Eval(Container.DataItem,"Price"))>0 ? "positiveStyle" :
    "negativeStyle"

    --
    HTH

    Thanks,
    Yunus Emre ALPÖZEN
    BSc, MCSD.NET

    "e2biz" <> wrote in message
    news:...
    >I want to change the style of a data presented based upon the value of the
    > data. For example, I if the value is positive I want it to appear black
    > but
    > if it is negative I want it to be red. Any suggestions would be helpful!
    >
    > --
    > Rob
    Yunus Emre ALPÖZEN [MCSD.NET], Nov 8, 2005
    #2
    1. Advertising

  3. You can alos try doing in the ItemDataBound.
    Patrick

    "Yunus Emre ALPÖZEN [MCSD.NET]" <yemre> wrote in message
    news:...
    > Just bind style or property you want.. I do not know your code but adding

    a
    > binding like this should do what u want.
    >
    > ((Decimal)DataBinder.Eval(Container.DataItem,"Price"))>0 ? "positiveStyle"

    :
    > "negativeStyle"
    >
    > --
    > HTH
    >
    > Thanks,
    > Yunus Emre ALPÖZEN
    > BSc, MCSD.NET
    >
    > "e2biz" <> wrote in message
    > news:...
    > >I want to change the style of a data presented based upon the value of

    the
    > > data. For example, I if the value is positive I want it to appear black
    > > but
    > > if it is negative I want it to be red. Any suggestions would be

    helpful!
    > >
    > > --
    > > Rob

    >
    >
    Patrick.O.Ige, Nov 8, 2005
    #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. =?Utf-8?B?U3RldmVuLkRhaGxpbg==?=

    htmlcontrols not reflecting changes upon return to the server

    =?Utf-8?B?U3RldmVuLkRhaGxpbg==?=, Aug 5, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    413
    Ken Cox [Microsoft MVP]
    Aug 6, 2004
  2. =?Utf-8?B?QWRpcw==?=
    Replies:
    0
    Views:
    383
    =?Utf-8?B?QWRpcw==?=
    Oct 19, 2004
  3. TJS
    Replies:
    3
    Views:
    548
  4. e2biz

    Style changes based upon Data Values

    e2biz, Nov 8, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    114
    alvinz_c
    Nov 9, 2005
  5. Jim Cobban
    Replies:
    5
    Views:
    175
Loading...

Share This Page