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.

SaveCellFormattedText event fired twice?

Thread ID:

Created:

Updated:

Platform:

Replies:

20084 Oct 8,2004 01:07 PM Oct 8,2004 05:06 PM Windows Forms 2
loading
Tags: GridControl
Sassan Danesh
Asked On October 8, 2004 01:07 PM

I have implemented handlers for QueryCellFormattedText and SaveCellFormattedText in order to allow percentage field handling (where user types ''5'' and this is treates as 5%). However, I notice that my handler receives two SaveCellFormattedText events for every cell change. Is this normal? My implementation of the handler is: String userValue = null; if(evt.Text[evt.Text.Length-1] == ''%'') { userValue = evt.Text.Substring(0, evt.Text.Length - 1); evt.Handled = true; } else { userValue = evt.Text; } double d; if (double.TryParse(userValue, System.Globalization.NumberStyles.Any, null, out d)) { userValue = "" + (d / 100d); evt.Handled = true; } if (evt.Handled) { evt.Style.Text = userValue; }

Administrator [Syncfusion]
Replied On October 8, 2004 04:58 PM

I see SaveCellFormattedText being raised twice as well. The first time happens as the grid tries to validate the cell contents. The second time occurs later jast as the grid is trying to save the value to the grid. I am not sure whether this is by design or not. I will have to forward it to Stefan to see if this is what he had in mind.

Administrator [Syncfusion]
Replied On October 8, 2004 05:06 PM

This is by design. The cell renderer class internally calls style.FormattedText = ControlText to determine the underlying cell value for the display text. This happens before the CurrentCellValidate event is raised and ensures the ControlValue for the renderer is up to date. 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.

;