Hi,
I currently have a collection class that is basically a List<T> called Preferences. T is a class with a property called PreferenceOrder.
I bind the collection to the radgrid on the RadGrid1_NeedDataSource like so:
the rad grid is defined as:
I have tried a few javascripts to swap the rows that are bound to this grid, but this is not being persisted to the datasource of the grid, which is the Preferences collection.
What can i do to perform this swap client side but have this reflected in the Preferences Collection on the unload of the page/control?
I currently have a collection class that is basically a List<T> called Preferences. T is a class with a property called PreferenceOrder.
I bind the collection to the radgrid on the RadGrid1_NeedDataSource like so:
| protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e) |
| { |
| this.RadGrid1.DataSource = Preferences; |
| } |
the rad grid is defined as:
| <telerik:RadGrid ID="RadGrid1" runat="server" GridLines="None" AllowPaging="True" CssClass="RadGrid" |
| AllowSorting="True" AutoGenerateColumns="False" ShowStatusBar="true" |
| OnPreRender="RadGrid1_PreRender" |
| OnNeedDataSource="RadGrid1_NeedDataSource" |
| OnUpdateCommand="RadGrid1_UpdateCommand" |
| OnInsertCommand="RadGrid1_InsertCommand" |
| OnDeleteCommand="RadGrid1_DeleteCommand" |
| > |
| <MasterTableView Width="100%" CommandItemDisplay="Top" AllowSorting="False" > |
| <Columns> |
| <telerik:GridTemplateColumn UniqueName="TestingMoveItemUp" HeaderText=""> |
| <ItemTemplate> |
| <asp:Image id="imgMoveUp" class="up" ImageUrl="~/images/applications/up.gif" |
| onclick="grd_RowMove(this, true);" |
| AlternateText="Move Up" runat="server"></asp:Image> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| <telerik:GridTemplateColumn UniqueName="TestingMoveItemDown" HeaderText=""> |
| <ItemTemplate> |
| <asp:Image id="imgMoveDown" class="down" ImageUrl="~/images/applications/down.gif" onclick="grd_RowMove(this,false);" AlternateText="Move Down" runat="server"></asp:Image> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn"> |
| </telerik:GridEditCommandColumn> |
| <telerik:GridTemplateColumn UniqueName="PreferenceOrder" HeaderText="Order" DataField="PreferenceOrder"> |
| </telerik:GridTemplateColumn> |
| <telerik:GridBoundColumn UniqueName="CourseCode" HeaderText="Code" DataField="CourseCode"> |
| <telerik:GridButtonColumn ButtonType="ImageButton" UniqueName="DeleteColumn" Text="Delete" CommandName="Delete" /> |
| </Columns> |
| </MasterTableView> |
| </telerik:RadGrid> |
I have tried a few javascripts to swap the rows that are bound to this grid, but this is not being persisted to the datasource of the grid, which is the Preferences collection.
What can i do to perform this swap client side but have this reflected in the Preferences Collection on the unload of the page/control?