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.

Displaying blank decimal cells when zero

Thread ID:

Created:

Updated:

Platform:

Replies:

4603 May 20,2003 11:35 PM May 21,2003 03:53 AM Windows Forms 2
loading
Tags: GridControl
Apolon Ivankovic
Asked On May 20, 2003 11:35 PM

Is there any way of blanking a bound grid cell based on it's state without affecting its CellValue or its editability? The situation I have is as follows: An account sheet control has been implemented which has columns for a debit amount and a credit amount. These are bound to a Debit and a Credit property respectively. These properties are just different representations of a private decimal amount field. The properties change value according to: amount > 0 results in Debit=0 and Credit=amount amount < 0 results in Debit=amount and Credit = 0 amount == 0 results in Debit=Credit=0 I want to be able to have only one of the Debit or Credit columns have any information displayed in them at one time, but for the user to be able to edit either one i.e. as per a typical financial program. My initial attempt was to process the QueryCellInfo event and change the cell to a blank text cell at runtime if the credit/debit cell value was zero. This works fine for display, but when you edit the cell to change a credit to a debit or vice versa then the following error message pops up: "Object type cannot be converted to target type" Presumably this occurs because the QueryCellInfo processing turned that cell into a string previously. Whats the best way of achieving the financial credit/debit column blanking/editing functionality I'm looking for using the Essential grid?

Apolon Ivankovic
Replied On May 21, 2003 03:48 AM

With some experimentation, I did find that setting the FormattedText property to an empty string in the QueryCellInfo event resulted in the functionality required. Is this a suitable solution?

Administrator [Syncfusion]
Replied On May 21, 2003 03:53 AM

That should be fine. Setting Text to an empty string should also work or setting the CellValue to System.DbNull. If you supply a empty string for Text or FormattedText what is happening is that a System.DbNull will be assigned to CellValue. Stefan

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.

;