ReorderList Control

May 23, 2008 at 9:41 AM
Edited May 23, 2008 at 10:00 AM
Hello,

I am unable to reorder items of ReorderList. DataSource attribute of this control is set to XmlDataSource. I get message while reordering items "Reorder failed. See details below. Failed to reorder".

I think that I must write function which will update xml file with data after reordering items of ReorderList.

Is this a good idea? And if it is, what should I do to make it work.

Code for the ReorderList Control:

<cc1:ReorderList runat="server" ID="rol1" DataSourceID="XmlDataSource1" SortOrderField="sort" DataKeyField="name"
PostBackOnReorder="false" AllowReorder="true" ItemInsertLocation="Beginning">
    <ItemTemplate>
      <%#XPath("id") %>
    </ItemTemplate>
    <ReorderTemplate>
        <asp:Panel ID="reorderPanel" runat="server" CssClass="reorderCue"></asp:Panel>
    </ReorderTemplate>
    <DragHandleTemplate>
        <div class="dragHandle"></div>
    </DragHandleTemplate>
</cc1:ReorderList>

Code for the XmlDataSource Control:

<asp:xmldatasource id="XmlDataSource1" runat="server" DataFile="~/XMLFile.xml" XPath="source/dane" />


and this is xml file:
<?xml version="1.0" encoding="utf-8" ?>
<source>
  <dane name="a1" sort="1">
    <id>1</id>
    <tresc>One</tresc>
  </dane>
  <dane name="a2" sort="2">
    <id>2</id>
    <tresc>Two</tresc>
  </dane>
  <dane name="a3" sort="3">
    <id>3</id>
    <tresc>Three</tresc>
  </dane>
</source>