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

Postback current Row, then refresh, AND retain control focus

6 Answers 332 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Trevor
Top achievements
Rank 1
Trevor asked on 26 Jan 2009, 06:20 AM
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?

6 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 27 Jan 2009, 07:17 AM
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.
0
Trevor
Top achievements
Rank 1
answered on 27 Jan 2009, 08:20 AM
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?
0
Nelson
Top achievements
Rank 1
answered on 06 Jan 2020, 01:08 PM

Hi Trevor ,

Did you find a solution for this  ?

 

Regards,

 

Nelson.

0
Attila Antal
Telerik team
answered on 09 Jan 2020, 08:23 AM

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.
0
Nelson
Top achievements
Rank 1
answered on 21 Jan 2020, 02:14 PM

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

0
Attila Antal
Telerik team
answered on 21 Jan 2020, 02:27 PM

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.
Tags
Grid
Asked by
Trevor
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Trevor
Top achievements
Rank 1
Nelson
Top achievements
Rank 1
Attila Antal
Telerik team
Share this question
or