views:

1943

answers:

4

I keep getting this error when trying to re-order items in my ReorderList control.

"Reorder failed, see details below.

Can't access data source. It does not a DataSource and does not implement IList."

I'm setting the datasource to a DataTable right now, and am currently trying to use an ArrayList datasource instead, but am discouraged because of this post on the internet elsewhere. The control exists within an update panel, but no other events are subscribed to. Should there be something special with the OnItemReorder event? Just confused as to how it works.

My question is, does anyone have any direct experience with this issue?

A: 

I've used it successfully in the past without much issue (binding to a List). Could you post some snippets of what you have in your front-end and code-behind?

John Miller
A: 

                        <cc1:ReorderList id="ReorderList1" runat="server" CssClass="Sortables" Width="400" >
                            <ItemTemplate>
                            <div class="sortablelineitem">
                            <a href="#" class="albmCvr" id="song13">
                            <img src="/images/plalbumcvr.jpg" alt="Name of Album" class="cvrAlbum" width="10"
                                height="10" />
                            Song 1 <span>by</span> Artist 1 </a>
                             <asp:ImageButton ID="ImageButton13" runat="server" ImageUrl="/images/btn_play_icon.gif"
                            ToolTip="Play Clip" CssClass="playClip" />
                             </div>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <h1>WHOA THE ITEM IS BEING DRAGGED!!</h1>
                            </EditItemTemplate>
                            <ReorderTemplate>
                            <div style="width:400px; height:20px; border:dashed 2px #CCC;"></div>
                            </ReorderTemplate>
                            <DragHandleTemplate>
                            <div style="height:15px; width:15px; background-color:Black;"></div>
                            </DragHandleTemplate>
                            <EmptyListTemplate>
                            There are no items in this playlist yet...
                            </EmptyListTemplate>
                        </cc1:ReorderList>

                        </ContentTemplate>
                            </asp:UpdatePanel>

is my Front end, and in the back end I'm just getting a datatable object and binding it OnLoad of a Non postback...

ReorderList1.DataSource = ds.Tables[1];
ReorderList1.DataBind();

Do I need to set the datasource again when the items are reordered?

+1  A: 

I figured it out. I converted the DataTable to an ArrayList then bound to the control. Thanks everyone for reading!

A: 

I found the same error caused when the table I was trying to sort had no initial values allocated to the DataKeyField. This had me tearing my hair out as it worked in my test environment, but not when I pushed it live. I'd also note that it threw a dialog box with the same message ON MY WEB SERVER CONSOLE. This had an abort/retry/ignore button set so effectively killed everything. Now that's just rude!

The solution was just to consecutively number the field values before using the control.

Andiih