Substituting 0 with empty string

Discussion in 'ASP .Net Datagrid Control' started by Anders K. Jacobsen [DK], May 3, 2005.

  1. Hi i have a list of objects which I bind to a datagrid

    Some of the columns are decimal type and in the database many of the values
    are 0. But I need the zeros to beed empty string instead of 0. how could i
    easily do that?

    Anders
     
    Anders K. Jacobsen [DK], May 3, 2005
    #1
    1. Advertisements

  2. Anders,

    The columns contain strings only. You can make a simple function that will
    check if the cell contains "0" and replace it to "" and databind the columns
    to this function. Alternatively you can access and change column content in
    ItemDataBound event.

    Eliyahu

    "Anders K. Jacobsen [DK]" <> wrote in message
    news:...
    > Hi i have a list of objects which I bind to a datagrid
    >
    > Some of the columns are decimal type and in the database many of the

    values
    > are 0. But I need the zeros to beed empty string instead of 0. how could i
    > easily do that?
    >
    > Anders
    >
    >
     
    Eliyahu Goldin, May 4, 2005
    #2
    1. Advertisements

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. Andy Fish
    Replies:
    2
    Views:
    453
    Young Seeker
    Dec 29, 2003
  2. Christian Schlichtherle
    Replies:
    8
    Views:
    593
    John Currier
    Jul 5, 2005
  3. lugal
    Replies:
    2
    Views:
    377
    Peter Otten
    Mar 23, 2005
  4. John Salerno
    Replies:
    6
    Views:
    436
    John Salerno
    May 10, 2006
  5. brahatha
    Replies:
    0
    Views:
    334
    brahatha
    Jun 6, 2007
  6. Tzury Bar Yochay
    Replies:
    1
    Views:
    539
    Gabriel Genellina
    Mar 24, 2008
  7. Savvoulidis Iordanis

    Empty gridview cells and checking for empty string

    Savvoulidis Iordanis, Sep 5, 2008, in forum: ASP .Net
    Replies:
    1
    Views:
    726
    Savvoulidis Iordanis
    Sep 5, 2008
  8. Federico ZagarzazĂș

    Error when substituting a backslash in a string

    Federico ZagarzazĂș, Jun 6, 2007, in forum: Ruby
    Replies:
    7
    Views:
    173
    Ryan Mcdonald
    Jun 7, 2007
Loading...