Display string instead of boolean

3 posts, 0 answers
  1. Charles
    Charles avatar
    1 posts
    Member since:
    Apr 2015

    Posted 07 Dec 2015 Link to this post

    I have a RadGridView that I populate with a DataTable. One of the fields that is in the DataTable is a column that contains boolean values. Instead of showing "True" or "False" in the column like it does now, I want it to show "In" or "Out". What is the simplest way to accomplish this? I am using Visual Studio 2013 and programming in Visual Basic. Thanks!
  2. Cyril
    Cyril avatar
    10 posts
    Member since:
    Sep 2014

    Posted 08 Dec 2015 in reply to Charles Link to this post


     You can use cellformating event with this code inside:

    if e.cellelement.value = true then

        e.cellelement.text = "in";


         e.cellement.text = "out";

    end if

  3. Dess | Tech Support Engineer, Sr.
    Dess | Tech Support Engineer, Sr.  avatar
    4132 posts

    Posted 08 Dec 2015 Link to this post

    Hello Charles,

    Thank you for writing.

    The suggested approach by Cyril is one possible option. Indeed, the CellFormatting event gives you the opportunity to customize the text displayed in the cell. Another option is to use a custom TypeConverter and convert the boolean value to the desired string if the cell value is displayed in a GridViewTextBoxColumn. Feel free to use this approach which suits your requirement best.

    I am looking forward to your reply.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top