DataFormatString in datagrid - {0:???} change 'true' 'false' to 'T' 'F' in display

Posted on 2006-03-30
Last Modified: 2012-06-22
Hello All,

When using a .net datagrid or grid view , does anyone know the
syntaxt that would change a bound field that is recieved as true/false
to display as T and F when the datagrid displays.

I'm really trying to display True/False as  "A" for Active or "I" for Inactive

thank You
Question by:paygo
    1 Comment
    LVL 6

    Accepted Solution

    I do not think you can do that using dataformatstring.

    For a 2.0 gridview you could use a templatefield for your field, if it is boolean the ItemTemplate  will be like
    <asp:Label ID="Label1" runat="server" Text='<%# (bool)Eval("YourBoolField")?"A":"I" %>'></asp:Label>

    The syntax in an 1 will be something like DataBinder.Eval(Container.DataItem,"YourBoolField").ToString()=="True"?"A":"I"

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK ( for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
    More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now