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

[Solved] Place Edit Mode onto next row after update on Radgrid

5 Answers 181 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Carina
Top achievements
Rank 1
Carina asked on 18 Jul 2013, 10:06 PM
Hi,

I have a question regarding RadFilter and Radgrid. I have a RadFilter outside the Radgrid that manipulates the data that is shown on the grid. I want to be able click on 'Edit' in one of the records, and once I update it (which will rebind the grid and not show the record I updated because of the filter that is still set by the RadFilter may not include that record anymore because of the update) I want it to go to the next record that was below it before the record disappeared in the rebind. I am using vb.net not c#, and Visual Studio 2010. Right now, since it rebinds, it skips a couple records and set it into edit mode, but I want it to set the next record after the one I edited (whether it is still there or not) to be set to edit mode.

This is in my update_command:

'after updating the record, open the next record to edit
        Dim nextItemIdx As Integer = e.Item.ItemIndex + 1
 
        Dim maxCnt As Integer = grd.Items.Count
 
        If Not (nextItemIdx < maxCnt) Then
            Return
        End If
 
        Me.grd.MasterTableView.Items(nextItemIdx).Edit = True
        Me.grd.MasterTableView.Rebind()

5 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 23 Jul 2013, 08:44 AM
Hello Carina,

Thank you for contacting us.

A possible solution is to save in a session the ID of the item and the ItemIndex. This way you could check (due to the applied filter) whether the previous updated item is still displaying in the grid or it is not. For your convenience I prepared a small sample and attached it to this thread.

Please give it a try and let me know if I could provide you any further assistance.

Regards,
Kostadin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Carina
Top achievements
Rank 1
answered on 23 Jul 2013, 04:51 PM
Hi Kostadin,

Thank you for your response. Unfortunately, it behaves the same as I currently have it. I am not sure if a solution will be possible since the items of the grid could change since the conditions will not match the filter, so it still just jumps onto the next couple records even though some have not been edited yet. I will try and see if I can get it to work.

Thanks!
0
Kostadin
Telerik team
answered on 26 Jul 2013, 10:58 AM
Hi Carina,

Could you please provide more detailed information on your scenario? Are you trying to edit all records in the grid or only the one which is filtered at the moment? Note that only the item currently shown in the grid could be edit.

Regards,
Kostadin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Carina
Top achievements
Rank 1
answered on 29 Jul 2013, 06:48 PM
Hi Kostadin,

Yes I can. So the radfilter I have could bring up more than one record in the grid depending on the filter conditions set. Right now, when I click the edit button on a record, it is just one record that I update at a time, and then once I click update, it should place the following record into edit mode as well. This works when the grid does not have any filters. But say for example, I filter the products that do not have any labels yet (Label IsNull), so the grid will bring up all the records of products without any labels, and I want to update the ones that now have labels, so I would start editing one, and once I update that one, since is NOW has a label, it no longer shows in the grid, but instead of the following record that was below is placed in edit mode, it skips two records, since it is reading the index of the record to place the next record in edit mode. What I want to fix is the skip issue. I want it to place the next record in edit mode, even if the record before is no longer there in the view.

Sorry I hope I did not confuse you more.

Thanks,

Carina
0
Andrey
Telerik team
answered on 01 Aug 2013, 12:00 PM
Hello,

I think I understood what your goal is.However, I am not sure whether it is possible for all cases. The approach that could be implemented is to always start with the item at index zero. Thus when you finish updating the item you would again go to the item with index zero which will be the next item.

If you want to start at a random position there will be always leap in the order of the items. This is true because the editing of RadGrid is dependent on the index of the item.

Another approach is to be irrelevant on which row the user is editing. Once it finishes editing the row you continue to the item at index zero.

These are the approaches I can think of. Choose the best for you and you should not have problems.

Regards,
Andrey
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Carina
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Carina
Top achievements
Rank 1
Andrey
Telerik team
Share this question
or