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
Syncfusion site will be temporarily unavailable for scheduled maintenance on December 14, 2024, from 10:30 PM ET to 11:30 PM ET.
close icon

GridListBox and AutoComplete

Hi, I''m looking for a list box which responds to key stroks and updates selection as in auto complete feature. I tried to work with GridListControl, but auto complete doesn''t seems to work there?! Any control or way to do this? Thanks, Gil K

1 Reply

AD Administrator Syncfusion Team January 11, 2005 03:30 PM UTC

The standalone GridListControl does not support AutoComplete, but the GirdListControl dropdown that appears in cells does. If you just want to do a first letter match, you could probably do this by handling the GridListControl.KeyDown event. Here is a little minimal handler that worked for me in our GridListControlSample. (You have to click the control first to it focus. But after that typing a letter takes you to the State Abbreviation.)

private void ListBox1_KeyDown(object sender, KeyEventArgs e)
{
	//Console.WriteLine("ListBox1_KeyDown");
	int start = this.ListBox1.SelectedIndex;
	int i = start + 1;
	string s = e.KeyCode.ToString();
	while (i > 0 && i < this.ListBox1.Grid.RowCount)
	{
		if(this.ListBox1.Grid[i + 1, 1].Text.StartsWith(s))
		{
			this.ListBox1.SelectedIndex = i;
			return;
		}
		i += 1;
	}
	i = 0;
	while(i < start)
	{
		if(this.ListBox1.Grid[i + 1, 1].Text.StartsWith(s))
		{
			this.ListBox1.SelectedIndex = i;
			return;
		}
		i += 1;
	}
}

Loader.
Up arrow icon