Hi,
I am evaluating gridview for winforms. I tried but couldnt get it workings ...here is that couple of things i would like to do (very keyboard intensive data entry) all operations performed using keyboard,no mouse at all
1. Validate a cell after data entry and if validation fails keep the focus in the same cell . escape should remove that row
2. after entering data for the last cell,add a new row and keep focus on the first cell in the newly added row and repeat this.
Any help is greatly appreciated.
Thanks
I am evaluating gridview for winforms. I tried but couldnt get it workings ...here is that couple of things i would like to do (very keyboard intensive data entry) all operations performed using keyboard,no mouse at all
1. Validate a cell after data entry and if validation fails keep the focus in the same cell . escape should remove that row
2. after entering data for the last cell,add a new row and keep focus on the first cell in the newly added row and repeat this.
Any help is greatly appreciated.
Thanks
6 Answers, 1 is accepted
0
Hi,
Thank you for writing.
1. To validate the cell's value you should use the CellValidating event. If you cancel the validation the user will not be able to go out of edit mode. More information is available here: http://www.telerik.com/help/winforms/gridview-editors-data-validation.html.
2. As to the second question, if I understand correctly, you want to select the first cell in the newly added row. If so, you can do that in the UserAddedRowEvent with the following code:
I hope this helps.
All the best,
Stefan
the Telerik team
Thank you for writing.
1. To validate the cell's value you should use the CellValidating event. If you cancel the validation the user will not be able to go out of edit mode. More information is available here: http://www.telerik.com/help/winforms/gridview-editors-data-validation.html.
2. As to the second question, if I understand correctly, you want to select the first cell in the newly added row. If so, you can do that in the UserAddedRowEvent with the following code:
void
radGridView1_UserAddedRow(
object
sender, GridViewRowEventArgs e)
{
radGridView1.CurrentRow = e.Row;
radGridView1.CurrentColumn = radGridView1.Columns[0];
}
I hope this helps.
All the best,
Stefan
the Telerik team
0
s
Top achievements
Rank 1
answered on 03 Dec 2012, 04:32 PM
Hi Stefan,
Thanks for responding. Sorry I wasn't clear in what i was asking.
1. I will try your suggestion.
For #2, Lets say its a data entry system with 5 columns in the grid. What i would like to know is that while entering the data for a row when i reach the 5th column and done with editing data and hit enter, i want to end the edit mode for the 5th column and add a new row below the newly added row (instead of clicking the add new row button in the grid).
firstname | lastname | middlename | city | state
----------------------------------------------------------------
tf tl tm newyork ny (done with entering data for the row & hit "enter" key i want to add new row below)
......
Thanks for responding. Sorry I wasn't clear in what i was asking.
1. I will try your suggestion.
For #2, Lets say its a data entry system with 5 columns in the grid. What i would like to know is that while entering the data for a row when i reach the 5th column and done with editing data and hit enter, i want to end the edit mode for the 5th column and add a new row below the newly added row (instead of clicking the add new row button in the grid).
firstname | lastname | middlename | city | state
----------------------------------------------------------------
tf tl tm newyork ny (done with entering data for the row & hit "enter" key i want to add new row below)
......
0
Hi,
I am sorry, but I am still unsure about the scenario.
RadGridView has a GridViewNewRowInfo - a new row on the top that allows you to add rows to the grid.
Below the new row are the data rows - GridViewDataRowInfos.
So now, you want :
1. When you are in the new row, to add value for cell1, cell2, cell3, cell4, cell5 and hit Enter and this row to be added and then you are back in cell1 in the new row?
Or, maybe
2. You want to be in some data row, add values to the cells and press Enter when you are in cell5 and right after the currently edited row which values are saved, add a new empty row with no values in it below the edited row and put the first cell from the row added in edit mode?
If none of the above is your case, please try providing additional details., video and/or sketches so I can get a clear picture of it, and help you implement it.
Thank you in advance for your cooperation.
Regards,
Stefan
the Telerik team
I am sorry, but I am still unsure about the scenario.
RadGridView has a GridViewNewRowInfo - a new row on the top that allows you to add rows to the grid.
Below the new row are the data rows - GridViewDataRowInfos.
So now, you want :
1. When you are in the new row, to add value for cell1, cell2, cell3, cell4, cell5 and hit Enter and this row to be added and then you are back in cell1 in the new row?
Or, maybe
2. You want to be in some data row, add values to the cells and press Enter when you are in cell5 and right after the currently edited row which values are saved, add a new empty row with no values in it below the edited row and put the first cell from the row added in edit mode?
If none of the above is your case, please try providing additional details., video and/or sketches so I can get a clear picture of it, and help you implement it.
Thank you in advance for your cooperation.
Regards,
Stefan
the Telerik team
0
s
Top achievements
Rank 1
answered on 06 Dec 2012, 08:46 PM
Its more like your #2 description.
1. i want to hide new row row on the top.
2. As the user enter couple of text fields on the top and tab brings the user to grid, put focus on the first cell and as they start typing the cell is in edit mode and values for all the cells are added and after the last cell editing is done and press enter currently edited row values are saved and an empty new row with no values in it below the edited row and put the first cell from the added row in edit mode.
1. i want to hide new row row on the top.
2. As the user enter couple of text fields on the top and tab brings the user to grid, put focus on the first cell and as they start typing the cell is in edit mode and values for all the cells are added and after the last cell editing is done and press enter currently edited row values are saved and an empty new row with no values in it below the edited row and put the first cell from the added row in edit mode.
0
Accepted
Hello,
Thank you for the clarification.
Attached you can find a sample project where I have implemented the desired behavior:
- the new row is hidden
- the user can edit the values in the cells and can tab through them
- when Enter is pressed in the last cell, new row is added and its first cell is in edit mode
Let me know how this works for you.
Regards,
Stefan
the Telerik team
Thank you for the clarification.
Attached you can find a sample project where I have implemented the desired behavior:
- the new row is hidden
- the user can edit the values in the cells and can tab through them
- when Enter is pressed in the last cell, new row is added and its first cell is in edit mode
Let me know how this works for you.
Regards,
Stefan
the Telerik team
0
s
Top achievements
Rank 1
answered on 07 Dec 2012, 03:56 PM
Works great. Thank you so much.