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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Lose selected cell when RefreshRange

Thread ID:





17009 Jul 29,2004 01:57 AM UTC Jul 29,2004 05:30 AM UTC WinForms 1
Tags: GridControl
Asked On July 29, 2004 01:57 AM UTC

Per a suggestion in the forum (http://www.syncfusion.com/support/Forums/message.aspx?MessageID=16469) I''m handling the CurrentCellMoved event, and calling RefreshRange() and then in QueryCellInfo setting colors to highlight the current row and column of the selected cell. I have set ActivateCurrentCellBehavior = GridCellActivateAction.SelectAll to select the text in a cell when the user moves into the cell. However, when calling RefreshRange() in the CurrentCellMoved event, I''m losing that selected text. What is the best way to get the selected text to remain after the RefreshRange() calls? I have poked around a bit, and realized that I could get at the RichTextBox control in the cell, then set the SelectedLength property. RichTextBox tb = grid1.CurrentCell.Renderer.Control as RichTextBox; if ( tb != null ) { int len = tb.Text.Length; tb.SelectionLength = len; } Any thoughts about this method, or any better ways to achieve this? (I do see a slight flicker in the selection doing it this way...text in the newly selected cell is selected, then not, then selected again) Thanks!!

Administrator [Syncfusion]
Replied On July 29, 2004 05:30 AM UTC

You could try turning off the ActivateCurrentCellBehavior = SelectAll, and do the SelectAll yourself at the bottom of your CurrentCellMoved with the code below. Hopefully, this would avoid the flicker you mentioned. GridCurrentCell cc = this.gridControl1.CurrentCell; cc.BeginEdit(); GridTextBoxControl tb = cc.Renderer.Control as GridTextBoxControl; if(tb != null) tb.SelectAll();


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon