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

Updatecommand hashtable sort

1 Answer 95 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jean-Marc
Top achievements
Rank 1
Jean-Marc asked on 09 Aug 2011, 11:27 AM
Hi, to get all edit row values I'm using hashtable as I found somewhere in the forum (can not know how many columns I'll have and their names).
The problem, and to me is a very big issue, is that when i iterate the hasttable, column order is completely lost (actually I don't even understand what kind of sorting it does). How can I have them in the original columns order?

Protected Sub RadGrid1_UpdateCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.UpdateCommand
       
            Dim editItem As GridEditableItem = CType(e.Item, GridEditableItem)
            Dim newValues As Hashtable = New Hashtable()
            e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editItem)
 
            For Each entry In newValues
                'LogManager.WriteToDebugLog("c:\log\qwe\", "- newValues key" & entry.key & "  value" & CType(entry.value, String))
            Next
 
End Sub

Thank you

1 Answer, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 12 Aug 2011, 10:49 AM
Hello Jean-Marc,

In order to implement the desired functionality, I recommend that you traverse the grid columns and populate a collection (for example a List of Pairs) with the column names in the same order. Then, you can associate the corresponding values to the Pairs from the Hashtable that you get using the code from your post.

Please give this approach a try and let me know how it goes.

Kind regards,
Mira
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
Jean-Marc
Top achievements
Rank 1
Answers by
Mira
Telerik team
Share this question
or