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. Image for the cookie policy date

DropDown Cells MaxLength property

Hello, I would like to set the MaxLength property of the textbox part of a ComboBox cell and a GridListControl cell in a virtual grid. I've tried to set the MaxLength property in the QueryInfoCell event - the length isn't limited. I've tried to set the MaxLength property of the TextPart of the renderer in the PrepareViewStyleInfo event - the length isn't limited either. Could you give me some advises please ?

2 Replies

AD Administrator Syncfusion Team October 30, 2003 09:36 AM UTC

Maybe you could use the CurrentCellKeyPress event. In it, identify the cell somehow and check the current length and set the e.Handled to true to ignore the keystroke.
private void gridControl1_CurrentCellKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
	GridCurrentCell cc = this.gridControl1.CurrentCell;
	if(cc.RowIndex == 2 && cc.ColIndex == 3 && cc.Renderer.ControlText.Length >= 4)
	{
		e.Handled = true;
	}
}


DM Denis Menard October 30, 2003 11:04 AM UTC

Works fine, thank you.

Loader.
Live Chat Icon For mobile
Up arrow icon