Postback current Row, then refresh, AND retain control focus

7 posts, 0 answers
  1. Trevor
    Trevor avatar
    3 posts
    Member since:
    Jan 2009

    Posted 26 Jan 2009 Link to this post

    Scenario / Requirements:

    I want to have a grid that looks and behaves almost exactly like excel.  Try to remember this key point.

    I want to be able to move around in the grid with my arrow keys (Ignore, I have read the various posts on this)
    I want to be able to edit any cell that currently has focus.  No, I don't want to click an Edit button first.  If I am in the cell and hit a key, I am editing the cell.

    MOST IMPORTANT:
    **After** I edit a cell, I need to do a partial postback to the server, where I will recalculate several other cells(columns) in the datasource bound to this control, using the updated value in the calling cell.  (The caluclations are performed on the server). Then, after the calculations are complete, I want the cell's row to update with the new values in the underlying dataset.   ***AND**, surprisingly, I don't want to lose focus of the control that received it after I updated the first cell.

    As far as I know, I have looked at all of the examples on your website, so I think this scenario extends a bit beyond the standard examples.

    So, is this possible with RadGrid, and if so, could you give me a few hints of how to do it?
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 27 Jan 2009 Link to this post

    Hi Trevor,

    Have you gone through the code library submission entitled ' Excel-like RadGrid '. If not, just have look at it which will help you to have a good start.
    Excel-like RadGrid

    Thanks
    Shinu.
  3. Trevor
    Trevor avatar
    3 posts
    Member since:
    Jan 2009

    Posted 27 Jan 2009 Link to this post

    I did see that article post, but my question is beyond that.

    I want to:
    1) After edit of a cell in a row....
    2) Do a partial postback of the page
    3) Using the newly updated cell value to perform calculations on the server, which will update other columns in the source dataset
    4) Return those new values to the appropriate cells in the edited datarow
    5) Focus must remain on the proper control (so, if I edited Row 4, Col 5, then tab to Row 4, Col 6, focus will remain on Row 4, Col 6 after the calculations are complete)

    Is this type of functionality possible with radGrid?
  4. Nelson
    Nelson avatar
    2 posts
    Member since:
    Mar 2019

    Posted 06 Jan 2020 Link to this post

    Hi Trevor ,

    Did you find a solution for this  ?

     

    Regards,

     

    Nelson.

  5. Attila Antal
    Admin
    Attila Antal avatar
    608 posts

    Posted 09 Jan 2020 Link to this post

    Hi there,

    By default the RadGrid handles navigating up and down using the arrow keys and right and left using the TAB or SHIFT+TAB keys. This can be seen in the Grid - Batch Editing online demo.

    There is also a Code Library sample for an excel like editing at Excel look and feel for RadGrid.

    Kind regards,
    Attila Antal
    Progress Telerik

    Get quickly onboarded and successful with UI for ASP.NET AJAX with the Virtual Classroom technical trainings, available to all active customers. Learn More.
  6. Nelson
    Nelson avatar
    2 posts
    Member since:
    Mar 2019

    Posted 21 Jan 2020 in reply to Attila Antal Link to this post

    Hi Attila,

    I went throw the links you have given but problem still there.
    I am also facing the same issue mentioned.

    The problem is i have some serverside validation in a Name Column. So after entering the name postback occur and validate the name and rebind the grid. At that time focus lose and user needs to do a mouse click.

    Is there any option or javascript to manually set the focus back to the next cell we edited. 

    Like while doing the post back keep the row and column name, then after postback based on stored cell details set the focus to next cell. Because during the postback i am rebinding the grid so surely the grid will lose the focus. 

    Please suggest if there is anything for this issue.

     

    Regards,

    Nelson

  7. Attila Antal
    Admin
    Attila Antal avatar
    608 posts

    Posted 21 Jan 2020 Link to this post

    Hi Nelson,

    In order to persist the selected row, selected cell, or anything else you have interacted with before the postback, you will need to implement a JavaScript logic to save that.

    For example, when you selected a row, save the ID of that row in a hidden field that is outside of the Grid. After the postback, when the Grid finished loading, access the hidden field's value, get the row's ID, find the Grid row by this ID and make it selected.

    Here are few links that explain several things you will need to know to work with the Grid on client-side:


    Kind regards,
    Attila Antal
    Progress Telerik

    Get quickly onboarded and successful with UI for ASP.NET AJAX with the Virtual Classroom technical trainings, available to all active customers. Learn More.
Back to Top