Automatically add row after last row tab in RadGrid?

4 posts, 0 answers
  1. Tejas
    Tejas avatar
    5 posts
    Member since:
    Mar 2011

    Posted 19 May 2011 Link to this post

    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?
    looking for same solution but in ...

  2. Gimmik
    Gimmik avatar
    170 posts
    Member since:
    May 2011

    Posted 20 May 2011 Link to this post

    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,
  3. DevCraft R3 2016 release webinar banner
  4. Tejas
    Tejas avatar
    5 posts
    Member since:
    Mar 2011

    Posted 24 May 2011 Link to this post

    Thanks Gimmik,

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

  5. Madhu
    Madhu avatar
    3 posts
    Member since:
    Nov 2012

    Posted 04 Mar 2013 Link to this post


    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
Back to Top