We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Question about Gridcontrol boolean value format

Hi all.

I am using a Gridcontrol to display data read from access database. What I need is to make the program be able to display boolean value both in checkbox and textbox format.

The True/False value can differ from different settings, for instance it can be Y/N, Ja/Nee etc.

I have not problem with checkbox by setting the checkbox options.

The problem is for textbox, it seems only recoginize True/False to be valid value, it shows empty cell when I use other strings like Y/N.

What I did is add the columns by increasing the "colcount" property, and set the cellValueType to be bool.

How can I configure the textbox so that it also displays corresponding True/False values in other format?

Thanks a lot for your help!

Kun

1 Reply

AD Administrator Syncfusion Team October 23, 2006 09:50 PM UTC

Hi Kun,

Please try the code below in the QueryCellFormattedText event handler, this helps in formatting things as you like for boolean values in textbox cells.

private void gridControl1_QueryCellFormattedText(object sender, GridCellTextEventArgs e)
{
if(e.Style.CellValueType == typeof(bool) && e.Style.CellType == "TextBox")
{
if(e.Value.ToString() == "True")
e.Text = "Yes";
else
e.Text = "No";
e.Handled = true;
}
}

Let me know if this helps.
Thanks,
Rajagopal


Loader.
Live Chat Icon For mobile
Up arrow icon