Home Forums WinForms controls Xceed Grid for WinForms Best way to do a lookup from within a column on the grid

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #13194 |

    I have a situation where I need to allow the user to lookup a company name from within a cell on the grid. Preferably I would like the user to be able to enter in part of the company name in the cell and hit enter and have additional code do a lookup and eventually return a valid name and id. However, hitting enter attempts to commit the record so, I was looking at an alternative way of doing this possibly having a small button in the cell which the user could click on and perform a lookup. The cell would still need to be able to have text entered into it, however.

    Is there a way I can intercept the “enter” ansi character before the grid attempts to commit the record and I can then do my lookup?

    Does anyone have any suggestions for what I am trying to accomplish?

    Thanks.

    Imported from legacy forums. Posted by DBAJAM (had 2913 views)

    User (Old forums)
    Member
    Post count: 23064

    One option would be to create a custom cell-editor. Just create a subclass of the default editor. Then you can override the ProcessCmdKey-method, to catch the Enter-key.

    Imported from legacy forums. Posted by Tommy (had 226 views)

    User (Old forums)
    Member
    Post count: 23064

    Thanks for the response.

    My only issue now is that for some reason the ProcessCmdKey does not fire
    when I am editing a cell and hit the enter key. When I am editing a cell and
    press any other key it does fire however.

    Thanks,

    John

    Imported from legacy forums. Posted by DBAJAM (had 311 views)

    User (Old forums)
    Member
    Post count: 23064

    Which class is your editor inheriting from? My custom editor is inheriting from TextBox.

    Imported from legacy forums. Posted by Tommy (had 4137 views)

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.