This is a migrated thread and some comments may be shown as answers.

ListBox Re-Order Not updating database

1 Answer 73 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
William
Top achievements
Rank 1
William asked on 06 Mar 2014, 05:18 PM
I am using radlistbox to change a display order field.  SqlDataSource fires updated event for appropriate items but the displayorder integer does not get changed.  I'm at a loss as to how to troubleshoot this issue.   code below.

<telerik:RadListBox runat="server" ID="rlbxFields" DataSourceID="sqlFields" AllowDelete="True" AllowReorder="True" DataKeyField="ID" DataSortField="DisplayOrder" DataTextField="LabelText" DataValueField="ID" AllowAutomaticUpdates="true" AutoPostBackOnReorder="true" AutoPostBackOnDelete="true" EnableDragAndDrop="true"></telerik:RadListBox>
<asp:SqlDataSource ID="sqlFields" runat="server" ConnectionString="<%$ ConnectionStrings:zPortalConnectionString %>" DeleteCommand="DeleteFormField" DeleteCommandType="StoredProcedure" InsertCommand="UpsertFormField" InsertCommandType="StoredProcedure" SelectCommand="GetFormFields" SelectCommandType="StoredProcedure" UpdateCommand="UpsertFormField" UpdateCommandType="StoredProcedure">
<DeleteParameters>
<asp:Parameter Name="ID" DbType="Guid" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="FormID" DbType="Guid" />
<asp:Parameter Name="ID" DbType="Guid" />
<asp:Parameter Name="LabelText" Type="String" />
<asp:Parameter Name="Type" Type="String" />
<asp:Parameter Name="DisplayOrder" Type="Int32" />
<asp:Parameter Name="Required" Type="Boolean" />
<asp:Parameter Direction="InputOutput" Name="ID_OUT" DbType="Guid" />
</InsertParameters>
<SelectParameters>
<asp:Parameter Name="FormID" DbType="Guid" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="FormID" DbType="Guid" />
<asp:Parameter Name="ID" DbType="Guid" />
<asp:Parameter Name="LabelText" Type="String" />
<asp:Parameter Name="Type" Type="String" />
<asp:Parameter Name="DisplayOrder" Type="Int32" />
<asp:Parameter Name="Required" Type="Boolean" />
<asp:Parameter Direction="InputOutput" Name="ID_OUT" DbType="Guid" />
</UpdateParameters>
</asp:SqlDataSource>

1 Answer, 1 is accepted

Sort by
0
Hristo Valyavicharski
Telerik team
answered on 10 Mar 2014, 02:42 PM
Hi Jim,

The definition of the ListBox looks good. Check if the Select and the Update commands are working properly. After you reorder the items look at the DB and verify that "DisplayOrder" field has been updated. If it is the the problem is with the Select command. Don't forget to add "ORDER BY" clause, so you can get the updated data:

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TestConnectionString %>" 
            SelectCommand="SELECT * FROM [Countries] ORDER BY [SortOrder]"


Regards,
Hristo Valyavicharski
Telerik

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

Tags
ListBox
Asked by
William
Top achievements
Rank 1
Answers by
Hristo Valyavicharski
Telerik team
Share this question
or