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

Grids, editing, GridAwareTextBoxes and showing the true cellvalue

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

3 Replies

AD Administrator Syncfusion Team 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


SH Sue Harris 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


AD Administrator Syncfusion Team 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.

Loader.
Live Chat Icon For mobile
Up arrow icon