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

Programmatic Sorting DetailTable

1 Answer 88 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 29 Apr 2011, 02:49 PM

I am using programmatic sorting on my radgrid that has both master and detail data. My sorting works fine for the master table and I am getting my child data via this event:

Private Sub RadGrid1_DetailTableDataBind(ByVal source As Object, ByVal e As GridDetailTableDataBindEventArgs) Handles RadGrid1.DetailTableDataBind
    Dim dataItem As GridDataItem = CType(e.DetailTableView.ParentItem, GridDataItem)
    Select Case e.DetailTableView.Name
        Case "Orders"
            Dim CustomerID As String = dataItem.GetDataKeyValue("CustomerID").ToString()
            e.DetailTableView.DataSource = GetDataTable("SELECT * FROM Orders WHERE CustomerID = '" & CustomerID & "'")
        Case "OrderDetails"
            Dim OrderID As String = dataItem.GetDataKeyValue("OrderID").ToString()
            e.DetailTableView.DataSource = GetDataTable("SELECT * FROM [Order Details] WHERE OrderID = " & OrderID)
    End Select
End Sub


What I can not figure out is how to sort my detail table.  In the 
 

 

 

Protected Sub RadGrid1_SortCommand1(sender As Object, e As Telerik.Web.UI.GridSortCommandEventArgs) Handles  RadGrid1.SortCommand

 

 

event I use    e.Item.OwnerTableView.DataSource = m_dtSort and e.Item.OwnerTableView.Rebind() to rebind my MasterTable.  How do I sort my detail data and rebind?

Thanks

John

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 30 Apr 2011, 07:09 AM
Hello John,

You can use the same RadGrid1_SortCommand1 event for sorting Detailtable. When sorting Detailtable 'e.Item.OwnerTableView' is detailtable. And you can rebind the detail table using e.Item.OwnerTableView.Rebind() .

Take a look at the following documentation.
http://www.telerik.com/help/aspnet-ajax/grid-controlling-sorting-modes.html

Thanks,
Princy.
Tags
Grid
Asked by
John
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or