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

GridView data entry workflow

2 Answers 134 Views
Grid
This is a migrated thread and some comments may be shown as answers.
marksweat
Top achievements
Rank 1
marksweat asked on 15 Jul 2008, 11:18 PM
I'm using the RadGrid's Insert/Update capabilities in an application where users can create/update/delete records. Generally there are many pages of records for the users to work with and the data is sortable. When a user adds a new record they often lose the context of where they are in the data with the default behavior of the RadGrid.

Let's say the users is on page 10 of 20 and they create a new record with a sort value like "AAAA". After the record is inserted the user is moved from page 10 and placed on page 20. The new record is probably going to be displayed on page 1. So the user ends up in a different place in the grid than they were previously and don't see the record they just created. I think a better interaction would be for the grid to be auto paged to the page containing the new record with the new record highlighted in some way so the user understand the new record was created properly.

I have several pages in my current application that use asp.net GridView and Details View controls together to perform the same sort of Insert/Update operations. These pages also have some messy custom code to figure out where new/updated record will appear in the grid and page the grid automatically to display them. I'm going to use this same technique with the RadGrid to get the behavior I want.

I'm wondering if I'm missing an easy way to get the RadGrid to behave how I want. Or, perhaps there's a better user interaction for working with sorted data and the RadGrid control that's recommended.

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 16 Jul 2008, 06:53 AM
Hi,

You can try the following code snippet to prevent the Grid from going to the last page on performing insert.

CS:
 private void RadGrid1_ItemCommand(object source, Telerik.WebControls.GridCommandEventArgs e) 
 { 
     if (e.CommandName == RadGrid.InitInsertCommandName)  
    { 
         e.Canceled = true
         e.Item.OwnerTableView.IsItemInserted = true
         e.Item.OwnerTableView.Rebind(); 
         return; 
     } 
 } 

You can also refer the following code library submission which explains how to select the last inserted row.
Select Last Inserted Row

Thanks
Shinu.
0
marksweat
Top achievements
Rank 1
answered on 16 Jul 2008, 05:18 PM
Shinu,

Thanks for the tip on how to keep the grid from jumping to the last page. This will help me.

I had already checked out the Select Last Insert Row from the Knowledge base. It helped me figure out how to highlight the selected row.

--Mark
Tags
Grid
Asked by
marksweat
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
marksweat
Top achievements
Rank 1
Share this question
or