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

Edit In Place With Autogenerated Rows

3 Answers 26 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Pete
Top achievements
Rank 1
Pete asked on 15 Jun 2012, 03:36 PM
Hi,

I'm currently attempting to make an edit page for a list of 30+ items that ideally need to be edited in place. To do this I'm using the AutoGenerateColumns = True method on the RadGrid to generate the columns I need automatically from the datasource, and this works without a problem. I've also used the AutoGenerateEditColumn = True to generate myself an edit column, which again worked perfectly. My problem then comes when trying to actually catch the update event.

I've made an event to handle the RadGrid.UpdateCommand event, but none of your examples on the following page actually seem to work for this situation:
http://www.telerik.com/help/aspnet-ajax/grid-updating-inplace-and-editforms.html

When I try and use the Auto-Generated Column Editors code the only column that it seems to be able to find is the auto-generated edit column, and then it moves on to rebinding the data using the RadGrid.NeedDataSource event, which then populates my table again with it's original data and not the data from my previous update. Is there a tutorial somewhere that will help me catch the updated data so I can update the datasource before it rebinds it?

Thanks for any help.

3 Answers, 1 is accepted

Sort by
0
Pete
Top achievements
Rank 1
answered on 18 Jun 2012, 03:37 PM
Hi again,

Looking at this some more, I've still not found the problem. Could you let me know how I access the edit boxes rather than the values in the normal columns? I've tried the following:
Private Sub rgdCardSchemes_ItemCommand(ByVal source As System.Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles rgdCardSchemes.ItemCommand
    If e.CommandName = RadGrid.UpdateCommandName Then
        Dim myEditItem As GridEditableItem = e.Item.OwnerTableView.ItemsHierarchy(e.Item.ItemIndexHierarchical)
  
        MsgBox(myEditItem("CardNumber").Text)
    End If
End Sub

Obviously I'm not doing anything with that value, just displaying it in a message box so I can view what value I get. I'm currently getting the value that's in the column before I try and update it, and when I click update it just displays the value that's currently in the original column, not the value I just typed in to the text box. I'm assuming I need something other than e.Item.OwnerTableView.ItemsHierachy etc but I can't find in the help section what that should be.

Thanks,
-Pete
0
Accepted
Eyup
Telerik team
answered on 19 Jun 2012, 03:30 PM
Hello Pete,

I have created a sample RadGrid page where I implemented the described scenario and demonstrated how to access the updated values. Please check out the attached application and try to make avail from the provided project.

All the best,
Eyup
the Telerik team
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 their blog feed now.
0
Pete
Top achievements
Rank 1
answered on 19 Jun 2012, 03:50 PM
Hi Eyup,

Thanks so much for that!! That example is awesome and it only took me twenty seconds of looking at the code to realise what I needed to do. I was considering trying to find an alternate way of coding what I needed, but you've just saved me from changing my plans.

Thanks so much!!
Tags
Grid
Asked by
Pete
Top achievements
Rank 1
Answers by
Pete
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or