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

Cell to accept only numbers?

Thread ID:

Created:

Updated:

Platform:

Replies:

46425 Jul 12,2006 08:57 PM UTC Jul 13,2006 12:12 PM UTC Windows Forms 1
loading
Tags: Grouping
Administrator [Syncfusion]
Asked On July 12, 2006 08:57 PM UTC

Hi, My grouping grid has a cell that is of CellType = "ComboBox". This cell is later cast to a GridComboBoxCellRenderer so that a datasource can be assigned to achieve an auto-complete effect. The datasource contains only integers. How can I prevent the user from entering non-numeric into that cell? I tried using TableControlCurrentCellValidateString but I couldnt get the desired affect. Thanks, Kav

Administrator [Syncfusion]
Replied On July 13, 2006 12:12 PM UTC

Hi Kav, When the GridDropDownStyle is set to AutoComplete, the user input is restricted to items from the ChoiceList or DataSource but the user can type text into the text box and the text box will be filled only with a matching choice. (Or) In an AutoComplete cell, you cant type in anything other than the content that is in the datasource or choicelist. You can use the code below to prevent the user from entering a non-numeric values, if the GridDropDownStyle is set to Editable. GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell; if(cc.Renderer.StyleInfo.CellType == "ComboBox") { try { int val = int.Parse(e.Inner.Text); } catch { MessageBox.Show("Invalid entry"); e.Inner.Cancel = true; } } FYI, the other dropdownstyles, GridDropDownStyle.Editable and GridDropDownStyle.Exclusive are explained below. 1) GridDropDownStyle.Editable : When you set Editable, any thing can be typed. User can edit the textbox contents and is not limited to the values in the existing choices. 2. GridDropDownStyle.Exclusive does not allow the user to edit. Input is restricted to items from the ChoiceList or DataSource. Let me know if you need any further assistance. Regards, Rajagopal

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

;