DataGrid Column number format

Discussion in 'ASP .Net Web Controls' started by Michael, Feb 4, 2005.

  1. Michael

    Michael Guest

    How does one format a number as follows:

    <> 0 : YES
    = 0: NO

    I've tried {0:YES;;NO} to no avail.

    --
    Michael White
    Programmer/Analyst
    Marion County, OR
     
    Michael, Feb 4, 2005
    #1
    1. Advertising

  2. Hi Michael,

    Is this in a datagrid? If so, you might need a template column:

    <asp:datagrid id="DataGrid1" runat="server"
    autogeneratecolumns="False">
    <columns>
    <asp:templatecolumn>
    <itemtemplate>
    <asp:Label runat="server" Text='<%# iif(
    DataBinder.Eval(Container, "DataItem.IntegerValue"),"Yes","No") %>'>
    </asp:label>
    </itemtemplate>
    </asp:templatecolumn>
    </columns>
    </asp:datagrid>

    Let us know if this helps?

    Ken
    Microsoft MVP [ASP.NET]


    "Michael" <xxx.xxx.xxx> wrote in message
    news:...
    > How does one format a number as follows:
    >
    > <> 0 : YES
    > = 0: NO
    >
    > I've tried {0:YES;;NO} to no avail.
    >
    > --
    > Michael White
    > Programmer/Analyst
    > Marion County, OR
    >
    >
     
    Ken Cox [Microsoft MVP], Feb 6, 2005
    #2
    1. Advertising

  3. Michael

    Michael Guest

    Thanks Ken..that's it.

    "Ken Cox [Microsoft MVP]" <> wrote in message
    news:%23ycTxy$...
    > Hi Michael,
    >
    > Is this in a datagrid? If so, you might need a template column:
    >
    > <asp:datagrid id="DataGrid1" runat="server"
    > autogeneratecolumns="False">
    > <columns>
    > <asp:templatecolumn>
    > <itemtemplate>
    > <asp:Label runat="server" Text='<%# iif(
    > DataBinder.Eval(Container, "DataItem.IntegerValue"),"Yes","No") %>'>
    > </asp:label>
    > </itemtemplate>
    > </asp:templatecolumn>
    > </columns>
    > </asp:datagrid>
    >
    > Let us know if this helps?
    >
    > Ken
    > Microsoft MVP [ASP.NET]
    >
    >
    > "Michael" <xxx.xxx.xxx> wrote in message
    > news:...
    > > How does one format a number as follows:
    > >
    > > <> 0 : YES
    > > = 0: NO
    > >
    > > I've tried {0:YES;;NO} to no avail.
    > >
    > > --
    > > Michael White
    > > Programmer/Analyst
    > > Marion County, OR
    > >
    > >

    >
     
    Michael, Feb 7, 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. Replies:
    1
    Views:
    704
    Joe Kesselman
    Sep 19, 2006
  2. Ken Starks
    Replies:
    4
    Views:
    349
    Ken Starks
    Jun 23, 2008
  3. Dave

    Format Phone Number String in Datagrid Column

    Dave, Dec 5, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    3
    Views:
    283
  4. Arne

    How can I format a number column in a datagrid

    Arne, Jan 5, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    4
    Views:
    118
  5. Fei Liu
    Replies:
    21
    Views:
    2,378
    John Bokma
    Dec 16, 2006
Loading...

Share This Page