Show/Edit boolean values using "Y" and "N"

Thread is closed for posting
1 posts, 0 answers
  1. 63F75A2C-1F16-4AED-AFE8-B1BBD57646AD
    63F75A2C-1F16-4AED-AFE8-B1BBD57646AD avatar
    1572 posts
    Member since:
    Oct 2004

    Posted 16 Mar 2007 Link to this post

    Requirements

    RadGrid for ASP .NET version

    RadControls for ASP .NET AJAX version

    2006 Q4 SP2 and later


    2008.1.415 and later
    .NET version

    2.0 and later
    Visual Studio version

    2005 and later
    Programming language

    C#
    Browser support

    all supported by RadGrid for ASP .NET


    all browsers supported by RadControls for ASP .NET AJAX


     
    PROJECT DESCRIPTION
    Sometimes it is a requirement to show and edit boolean values as text. This can be achieved quite easily using GridTemplateColumn. In its item template you can insert a Label control with Text property set to '<%# (bool)Eval("Discontinued")? "Y": "N" %>'. In the edit template place a TextBox control with the same Text property.
    Thus "Y"/"N" value will be shown depending on the boolean value. In order to convert the "Y"/"N" value to boolean  wire the UpdateCommand event pass the edited value to the data source control.

    A similar approach is used for Inserting, using Setting predefined values for different column editors.
Back to Top

This Code Library is part of the product documentation and subject to the respective product license agreement.