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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

specialized cell editor

Thread ID:





40008 Jan 23,2006 06:58 PM UTC Jan 24,2006 12:14 PM UTC WinForms 2
Tags: GridControl
Asked On January 23, 2006 06:58 PM UTC

Could someone suggest an approach to cell behavior I need. It has some of the flavor of a mask, and some not. I''m not adverse to writing a custom renderer, but I''d hate to do that for nothing, if what I need can be done in vanilla cell types and events. Here''s the behavior. 1. When the cell is blank (ie Cell Value = null, or the string.Empty or cell.text="*") the cell should display "*". I don''t need all these conditions, any one is sufficient. 2. When the user clicks on the cell and types a digit, the "*" should be replaced with the digit, and the cell should behave like a mask edit box with a numeric mask that contains literals -- e.g. "9.## mm" 3. The cell must respect a specified minimum value (typically zero) and an optional maximum value. 4. If the user blanks out the entry with any of the customary techniques (delete, backspace keys , selectall/delete, the cell should revert back to "*" My first idea was to use the MaskEdit cell with a blank mask, and then in the validatingString event, detect the first digit entry, and then set the mask from inside the event, but that seems to swallow the first digit. (I''m sure there are rules about what you can change in a cell during an event...) Am I missing something really simple?

stanleyj [Syncfusion]
Replied On January 23, 2006 09:18 PM UTC

Hi Ralph, This KnowledgeBase article ''How do I put a cell in overstrike mode so that the characters get replaced instead of being inserted as you type.'' may help you. Here is a code that does a little of what you need. private void gridControl1_CurrentCellKeyPress(object sender, KeyPressEventArgs e) { GridTextBoxCellRenderer cr = this.gridControl1.CurrentCell.Renderer as GridTextBoxCellRenderer; if(e.KeyChar != Convert.ToChar(Keys.Back) && cr.TextBox.SelectionLength == 0) { cr.TextBox.SelectionLength = 1; //Programatically selecting One char. if(cr.TextBox.SelectedText == ".") cr.TextBox.SelectionStart += 1; //Skipping the dot } } For the rest I think you need to do some sort of custom validation. Refer this article. Best regards, Stanley

Replied On January 24, 2006 12:14 PM UTC

Stanley, Thanks for the suggestions. I think you helped point me in the right direction. ''best -r


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