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.
Unfortunately, activation email could not send to your email. Please try again.

Question about Gridcontrol boolean value format

Thread ID:

Created:

Updated:

Platform:

Replies:

50895 Oct 23,2006 07:40 AM Oct 23,2006 05:50 PM Windows Forms 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On October 23, 2006 07:40 AM

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

Administrator [Syncfusion]
Replied On October 23, 2006 05:50 PM

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


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;