Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2325
Displaying Yes/No for bool column
posted

I have a grid whose data source has a column that is Bit (bool).  In my InitializeLayout I check for the column and set the CellDisplayStyle to CellDisplayStyle.PlainText.  This results in either true or false.  I would like yes or no... How can I do this?

  • 29045
    Verified Answer
    Offline posted

    Hello,

    You could define a ValueList and set the ValueList property of the column when the grid is initialized. I attached a sample demonstrating this.

    private void ultraGrid1_InitializeLayout(object sender, InitializeLayoutEventArgs e) 
    {    
        ValueList vl=new ValueList();
        vl.ValueListItems.Add(true, "Yes");   
        vl.ValueListItems.Add(false, "No");  
        e.Layout.Bands[0].Columns["Bool"].ValueList=vl;
    }

    Let me know if you have any questions regarding this matter.

    BooleanColumnCustomText.zip