I am binsing a collection of business objects (LLBL entities) to a rad grid -- when i add new items to the collection they are soring at the top of the grid rather than at the ned, which is where i am adding them in the collection.
How can i prevent the rad grid from resorting? it appears to be resorting my collections as well - when i rebind i find that the order of objects in my collection has changed.
How can i prevent the rad grid from resorting? it appears to be resorting my collections as well - when i rebind i find that the order of objects in my collection has changed.
3 Answers, 1 is accepted
0
Hi jelling,
Please check my reply in in this thread:
http://www.telerik.com/community/forums/thread/b311D-bchebm.aspx
Best wishes,
Vlad
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Please check my reply in in this thread:
http://www.telerik.com/community/forums/thread/b311D-bchebm.aspx
Best wishes,
Vlad
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

jelling
Top achievements
Rank 1
answered on 09 Sep 2008, 03:22 PM
That doesn't seem to work work for me.
I set AllowSorting=True and AllowCustomSorting=:True. I have also created a Custom Sorting event handler to Cancel any sort operations.
However, when I add an object to my collection and rebind the grid, it is still resorting my collection, putting it in a new order rather than simply adding the most recently added item to the end.
The general function of the radgrid should be to let the user add items to teh grid and re-order them using drag and drop.
Why is the radgrid reordering the collection upon a Rebind()? Not only is the order changed in the grid, the order of the object is changed in the underlying collection as well.
.
I set AllowSorting=True and AllowCustomSorting=:True. I have also created a Custom Sorting event handler to Cancel any sort operations.
However, when I add an object to my collection and rebind the grid, it is still resorting my collection, putting it in a new order rather than simply adding the most recently added item to the end.
The general function of the radgrid should be to let the user add items to teh grid and re-order them using drag and drop.
Why is the radgrid reordering the collection upon a Rebind()? Not only is the order changed in the grid, the order of the object is changed in the underlying collection as well.
Protected Sub RadGrid_QuestionGroups_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid_QuestionGroups.NeedDataSource |
'MeMe.RadGrid_QuestionGroups.MasterTableView.DataSource = Me.SelectedQuestionGroupAssignments |
MeMe.RadGrid_QuestionGroups.DataSource = Me.SelectedQuestionGroupAssignments |
End Sub |
Protected Sub RadGrid_QuestionGroups_SortCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridSortCommandEventArgs) Handles RadGrid_QuestionGroups.SortCommand |
' custom sort which exists just to make the default sort not happen |
e.Canceled = True |
End Sub |
<telerik:RadGrid ID="RadGrid_QuestionGroups" runat="server" |
GridLines="None" AutoGenerateColumns="False" AllowSorting="True"> |
<MasterTableView EnableColumnsViewState="False" AllowCustomSorting="True" AutoGenerateColumns="true"> |
<Columns> |
<telerik:GridBoundColumn HeaderText="Group Name" DataField="QuestionGroup.Name" UniqueName="QuestionGroup.Name"></telerik:GridBoundColumn> |
<telerik:GridButtonColumn ConfirmText="Really remove this group?" Text="Remove" CommandName="RemoveGroup" UniqueName="column"></telerik:GridButtonColumn> |
</Columns> |
<DetailTables> |
<telerik:GridTableView runat="server" HierarchyLoadMode="Client" |
EnableColumnsViewState="False" CommandItemDisplay="Bottom" AllowNaturalSort="False"> |
<RowIndicatorColumn> |
<HeaderStyle Width="20px" /> |
</RowIndicatorColumn> |
<ExpandCollapseColumn> |
<HeaderStyle Width="20px" /> |
</ExpandCollapseColumn> |
<Columns> |
<telerik:GridBoundColumn HeaderText="Description" DataField="Question.Description" UniqueName="Description"></telerik:GridBoundColumn> |
<telerik:GridBoundColumn HeaderText="Type" DataField="Question.QuestionType.Description" UniqueName="Type"></telerik:GridBoundColumn> |
<telerik:GridCheckBoxColumn HeaderText="Hide" DataField="IsHidden" DataType="System.Boolean" UniqueName="IsHidden"></telerik:GridCheckBoxColumn> |
<telerik:GridTemplateColumn HeaderText="Edit" UniqueName="TemplateColumn"> |
<ItemTemplate> |
<asp:LinkButton runat="server" ID="LinkButton_EditQuestion" Text="Edit"></asp:LinkButton> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
</Columns> |
<CommandItemTemplate> |
<div style="float:right;"> |
<asp:Button runat="server" ID="Button_AddQuestion" |
Text="Add New Questions" CssClass="box" /> |
</div> |
</CommandItemTemplate> |
</telerik:GridTableView> |
</DetailTables> |
<RowIndicatorColumn> |
<HeaderStyle Width="20px" /> |
</RowIndicatorColumn> |
<ExpandCollapseColumn Visible="True"> |
<HeaderStyle Width="20px" /> |
</ExpandCollapseColumn> |
</MasterTableView> |
<ClientSettings AllowRowsDragDrop="True"> |
<Selecting AllowRowSelect="True" /> |
</ClientSettings> |
<FilterMenu EnableTheming="True"> |
<CollapseAnimation Duration="200" Type="OutQuint" /> |
</FilterMenu> |
</telerik:RadGrid> |
0
Hello jelling,
Generally if you do not have sort expression the grid will not try to reorder your collection. Furthermore even when sorting the will not change your original collection - everything will be performed on a copy of your collection.
Can you verify what will be the behavior with standard MS GridView in your case?
Kind regards,
Vlad
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Generally if you do not have sort expression the grid will not try to reorder your collection. Furthermore even when sorting the will not change your original collection - everything will be performed on a copy of your collection.
Can you verify what will be the behavior with standard MS GridView in your case?
Kind regards,
Vlad
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.