How to get a ordered items list after drag

2 posts, 0 answers
  1. James O'Brien
    James O'Brien avatar
    19 posts
    Member since:
    Oct 2009

    Posted 09 Nov 2010 Link to this post

    I'm looking to be able to handle the reorder myself in the server side RowDrop event using a post drag reordered list. I'll loop thru myself and reorder my data. Is that possible?

        <MasterTableView DataKeyNames="HomeQuickLinkID">
                <telerik:GridBoundColumn DataField="HomeQuickLinkID" Display="false"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="LinkTitle" HeaderText="Link Title"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="LongShowDate" HeaderText="Show Date"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="LongUpdatedDate" HeaderText="Last Updated"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="UpdatedName" HeaderText="Last Updated By"></telerik:GridBoundColumn>
                <telerik:GridButtonColumn ButtonType="LinkButton" Text="Move Up" CommandName="UpQL"><ItemStyle Width="50px"></ItemStyle></telerik:GridButtonColumn>
                <telerik:GridButtonColumn ButtonType="LinkButton" Text="Move Down" CommandName="DownQL"><ItemStyle Width="70px"></ItemStyle></telerik:GridButtonColumn>
                <telerik:GridButtonColumn ButtonType="LinkButton" Text="Edit" CommandName="EditQL"></telerik:GridButtonColumn>
                <telerik:GridButtonColumn ButtonType="LinkButton" Text="Delete" CommandName="DeleteQL"></telerik:GridButtonColumn>
        <ClientSettings EnablePostBackOnRowClick="true"  AllowRowsDragDrop="True">
            <Selecting AllowRowSelect="True" UseClientSelectColumnOnly="true"/>

    protected void grdPendingOrders_RowDrop(object sender, GridDragDropEventArgs e)
            int o = 0;
            NextGen.core.CMS.HomeQuickLinkManager m = new NextGen.core.CMS.HomeQuickLinkManager();
            foreach (GridDataItem i in e.[ReorderedItemsLists])
                o = o + 1;
                m.EditOrder((int)draggedItem.GetDataKeyValue("HomeQuickLinkID"), o);           
  2. Tsvetina
    Tsvetina avatar
    1862 posts

    Posted 12 Nov 2010 Link to this post

    Hello James,

    There should be no problem reordering the rows manually. You just need to change their order in the datasource and rebind the grid, as demonstrated in our online demo (take a look in the code behind at the case where the OwnerGrid is the first grid itself).

    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft R3 2016 release webinar banner
Back to Top