This is a migrated thread and some comments may be shown as answers.

Automatically add row after last row tab in RadGrid?

3 Answers 339 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tejas
Top achievements
Rank 1
Tejas asked on 19 May 2011, 08:59 PM
I would like to have the grid automatically add a new row when the user presses "Tab" from the last cell in the last row of the grid.

For example:
1. Focus is given to the top-left cell in the grid.
2. Grid is displayed with deafult empty rows(e.g. 5 ) and user can add new data in textbox / dropdown
3. User can navigave row cells but pressing "tab"
4. after last row last cell  "Tab" create new emapy row in grid.
5. also allow to create row from "Add row button".
6. at the end user can save all row data
(Featue like word table after end tab create new row...)

Any ideas on how to make the grid keep adding more rows automatically?

http://www.telerik.com/community/forums/winforms/gridview/automatically-add-new-row.aspx
looking for same solution but in asp.net ...

Thanks
Tejas

3 Answers, 1 is accepted

Sort by
0
Gimmik
Top achievements
Rank 1
answered on 20 May 2011, 09:43 PM
Hi Tejas,

I worked through a project similar to this not too long ago. The easiest way I know to create a new blank row is to add a blank row to the end of your datasource and rebind the grid. Since you want this row to not be permanent until the user clicks "save," you''ll need a working datasource. The way I accomplished this was to programmatically create the DataTable on page_load and bind that to the RadGrid. The trick is to create a "dirty bit" column, i.e. a hidden column that marks which rows you have added/updated so you don't have to update the whole structure to the original datasource, just the rows modified.

So once to create your method that adds a row to the DataSource, you can easily call it from any client-side or server-side events. I would wire-up the OnKeyPress event to create a new row when Tab is pressed and using the cell and column index to determine if you're in the correct location. I prefer just using a low profile "add row" for performance concerns.

Hopefully some of this is useful to you,
-Gimmik
0
Tejas
Top achievements
Rank 1
answered on 24 May 2011, 09:28 PM
Thanks Gimmik,

can you provide me sample code ?  I am kind of confused to get key press event on last cell.

Thanks
0
Madhu
Top achievements
Rank 1
answered on 04 Mar 2013, 03:12 PM
Hi,

Can you share the code if you have laready resolved this adding new row on tab out to radgridview..

I need to do the same kind of implementaion.

Thank You,
Madhu Rao
mrao0179@gmail.com
Tags
Grid
Asked by
Tejas
Top achievements
Rank 1
Answers by
Gimmik
Top achievements
Rank 1
Tejas
Top achievements
Rank 1
Madhu
Top achievements
Rank 1
Share this question
or