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

1 posts, 0 answers
  1. Telerik Admin
    Telerik Admin avatar
    1695 posts
    Member since:
    Oct 2004

    Posted 16 Mar 2007 Link to this post


    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

    Browser support

    all supported by RadGrid for ASP .NET

    all browsers supported by RadControls for ASP .NET AJAX

    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