We are using infragistics 2008 vol 2. We need to save the record whenever user hits ENTER key. For this we have placed a default button our form. Most of the times when user has chaged data in a girid's cell and hits enter our default button's click event is fired and record is saved. But some times hitting ENTER key results in change of line and default buttons click event is not fired.
I would appreaciate if some one can point out whay this occurs and how we can change behavior of the grid
thanks in advance,
Abhishek
Hi Abhishek,
It sounds like some of the fields in your grid accept multi-line text. You can turn this off by setting CellMultiline on the column to false.
I'm pretty sure that this property defaults to false, though. So if some cells are allowing you to have multi-line text, then something in your applicaiton is probably turning this functionality explicitly.
Hi Mike,
Thanks for prompt reply. None of the cells accept multiline text. Incidentlly some times hitting ENTER in same cell results in firing of default button click event and in other cases it is change of line. I believe this is some what related to row state, as this mostly happens when user enters data in a Template row and hits ENTER
I could be wrong, but I don't think the grid does that by default unless the row you are on is a fixed template add row.
It sounds to me like either something in your code is doing this, or else their is something in the KeyActionMappings of the grid for the Enter key that I am unaware of. You might want to loop through the grid's KeyActionMappings and examine the ones that are for the Enter key and see if any of them move to a new line. If so, you could remove the mapping.
You are absolutely correct. This behavior occurs when user starts entering data in fixed template add row. As soon as user enters some data a new row is added to botton, and if user hits ENTER at this point, focus is shifted to newly added row. I am not sure whats causing this, because I have noticed that if first two cells of template row are entered and if at this point user hits ENTER focus is shifted. But if user enters data in all the three columns and hits ENTER focus is not shifted to new row. This is happening in almost all the grids in the application.
We have not added any new mapping to the grid. I have tried removing all the mappings related to key ENTER but no luck.
thanks,
Abhishek Jain
I'm not sure why you are getting inconsistent behavior. Perhaps the last cell is not editable or the Activation property has been set to something else?
The ENTER key behavior you are describing here is correct. The grid is supposed to move to a new row when the user is in a Fixed TemplateAddRow and pressed the ENTER key. But this is controlled by the KeyActionMappings and if you remove the mapping, it should stop doing this. So either you have not properly removed the KeyActionMapping or something is wrong.
I tried removing all KeyActionMappings related to ENTER and RETURN but it did not help. On pressing ENTER infragistics commits TemplateRow and starts a new template row. Problem is that ENTER key is lost in this process. My form traps ENTER key to save the record.
Found solution for the issue. Now I can trap ENTER in key down event. I was unable to trap ENTER in key down event earlier (may be due to a programming mistake on our part). Issue is solved. Thanks for your help and support