GridListControl Cell : Should not allow new value

Hi,

I have a GCC in which i have set one column as GridListControl.
I have some data which I am populating from database.

I want to force the user not to enter new value in the cell where the GridListControl is. A user can only type and not enter new, which happens in a ComboBoxAdv control where I can set property AllowNewText = false;

How can I acheive this in GridListControl Dropdown within a cell.
I had gone through the properties using CellRender but could not succeed in it.

Can any one please help me regarding this.

Thanks,
Piyush

1 Reply

RC Rajadurai C Syncfusion Team August 20, 2009 07:19 AM UTC

Hi Piyush,

Thanks for your interest in Syncfusion Products.

In GridListControl celltype, there is no property support available similar to 'AllowNewText' of ComboBoxAdv control. Since ComboBoxAdv is a tools control designed to handle as seperate control, this property has been implemented in it. However, if you would like to achieve similar functionality in GridListControl celltype in grid, you can handle TableControlCurrentCellKeyPress event with the following code.

bool b;
GridCurrentCell cc = e.TableControl.CurrentCell;
if (cc.Renderer is GridDropDownGridListControlCellRenderer)
{
GridDropDownGridListControlCellRenderer rend = cc.Renderer as GridDropDownGridListControlCellRenderer;
b = false;
rend.ReplaceSel("");
string s = rend.ControlText+"" + e.Inner.KeyChar.ToString();
foreach (string item in dept)
{
if (item.StartsWith(s,StringComparison.CurrentCultureIgnoreCase))
{
b = true;
break;
}
}
if (!b)
e.Inner.Handled = true;
else
e.Inner.Handled = false;
}

Here is a sample for your reference in which this code has been implemented.
http://files.syncfusion.com/support/samples/Grid.Windows/7.3.0.20/F88809.zip

Regards,
Rajadurai

Loader.
Up arrow icon