I have a GridDataBoundGrid that contains a column called "PersonID". To populate this column I''d like the user to be able to type a few characters of a persons name and then either a) leave the field b) hit return c) click on the drop down button. Then I want to use what they typed in to access the database to retrieve a dataset containing "PersonID"s and "Name"s that match on "Name" and then show them in a GridList so that the user can select a match. As far as the user is concerned they see "Names" and not "PersonIDs".
I would like to do this in several places in my application, so is there a good way of wrapping this up as a re-usable control?
Thanks in Advance.
ADAdministrator Syncfusion Team November 10, 2004 08:37 AM
You could use a GridDropDouwnGridListControl (celltyp = "GridListControl") to get a running start at this.
What you could do is to set the column''s datasource, displaymember, and valuemember to be what you want so it picks up the foreign table.
To handle the displaying the partial list when the user types a few characters and click teh drop button, you could handle the CurrentCellShowingDropdown event, and there dynamically filter the list so it only shows the items that match the type values. To get teh typed value, you would use grid.CurrentCell.Renderer.ControlText within CurrentCellShowingDropdown. Here is a KB link the does something of this nature. (It does filter teh droplist, but does not use the ControlText.) http://www.syncfusion.com/Support/article.aspx?id=567
To handle the Enter key, try the grid.CurrentCellKeyDown event, and in it call grid.CurrentCell.ShowDropdown when the key is the enter key.