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.
Syncfusion Feedback

Grids, editing, GridAwareTextBoxes and showing the true cellvalue

Thread ID:

Created:

Updated:

Platform:

Replies:

42189 Mar 22,2006 09:31 AM UTC Mar 28,2006 05:31 AM UTC WinForms 3
loading
Tags: GridControl
Sue Harris
Asked On March 22, 2006 09:31 AM UTC

Hi, I''ve got a GridAwareTextBox attached to a virtual grid. I want it to show the actual value of the current cell so that users can edit the underlying values of my grid, but it always shows the formatted value (so the users are effectively loosing large amounts of the data). Likewise, when a cell goes into edit mode I''d like it to show the true value not the formatted value. eg if the CellValue is 0.005 and the format is set to N2, the cell shows 0.01. When the cell is selected the GridAwareTextBox should show 0.005 and the grid (still) 0.01. When I start editing the cell the grid cell should change to 0.005. How can I get this to work? Thanks, Sue

Administrator [Syncfusion]
Replied On March 23, 2006 03:24 PM UTC

Hi Sue, The intent behavior can be achieved by handling the QueryCellFormattedText event. Sample attached. Let us know if this helps. Regards, Calvin.

42189.zip

Sue Harris
Replied On March 27, 2006 09:44 PM UTC

That was a pretty good solution, but it prevents combo boxes from being able to change the cell value. Cheers, Sue

Administrator [Syncfusion]
Replied On March 28, 2006 05:31 AM UTC

Hi Sue, Setting the e.Text to cc.Renderer.ControlValue.ToString() in the QueryCellFormattedText event handler works for ComboBox cell types also. Below is a code snippet. Let me know if this helps. private void gridControl1_QueryCellFormattedText(object sender, GridCellTextEventArgs e) { GridCurrentCell cc = this.gridControl1.CurrentCell; if(e.Value !=null&& e.TextInfo == GridCellBaseTextInfo.CurrentText) { //e.Text = e.Style.Text; e.Text = cc.Renderer.ControlValue.ToString(); e.Handled = true; } } Regards, Calvin.

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.

Warning Icon 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.Close Icon

;