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