Groups | Blog | Home
all groups > asp.net webcontrols > february 2005 >

asp.net webcontrols : DataGrid Column number format


Michael
2/4/2005 3:21:45 PM
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]
2/5/2005 10:34:00 PM
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]


[quoted text, click to view]
Michael
2/7/2005 1:50:19 PM
Thanks Ken..that's it.

[quoted text, click to view]

AddThis Social Bookmark Button