Note that there are some explanatory texts on larger screens.

plurals
  1. POASP.NET ReorderList - Update Fails
    text
    copied!<p>I have an AjaxControlToolkit ReorderList bound by a SQLDataSource to a table with the following schema:</p> <pre> OrgID MilestoneID Name Priority </pre> <p>The Priority field is attached to the ReorderList as its SortOrderField. OrgID is specific to each user that logs in. The idea is that there is a different list of Milestones for each Org.</p> <p>I am using no code behind. In the EditItemTemplate i have two ImageButtons for Update and Cancel. When I click Update the Name of the milestone gets updated but the Priority gets set to null. I cannot figure out why this is happening.</p> <p>Here is the source code for the ReorderList and its SQLDataSource:</p> <pre><code>&lt;cc1:ReorderList ID="ReorderList1" runat="server" AllowReorder="True" CssClass="reorderStyle" DataKeyField="MilestoneID" DataSourceID="SqlDataSource2" OnItemDataBound="ReorderList1_ItemDataBound" OnItemReorder="ReorderList1_ItemReorder" PostBackOnReorder="True" SortOrderField="Priority" Width="400px"&gt; &lt;ItemTemplate&gt; &lt;asp:ImageButton ID="ImageButton2" runat="server" CommandName="Edit" ImageUrl="~/Images/edit.gif" /&gt; &lt;asp:Label ID="Label1" runat="server" Text='&lt;%# Eval("Name") %&gt;' ForeColor="Navy" Font-Names="Arial" /&gt; &lt;/ItemTemplate&gt; &lt;DragHandleTemplate&gt; &lt;img src="../Images/GrabIcon.GIF" style="cursor: move" /&gt;&amp;nbsp; &lt;/DragHandleTemplate&gt; &lt;InsertItemTemplate&gt; &lt;/InsertItemTemplate&gt; &lt;EmptyListTemplate&gt; &lt;asp:Label ID="Label4" runat="server" Font-Bold="True" Font-Italic="False" ForeColor="Red" Text="There are no Associated Milestones currently in the database"&gt;&lt;/asp:Label&gt; &lt;/EmptyListTemplate&gt; &lt;EditItemTemplate&gt; &lt;asp:TextBox ID="TextBox1" runat="server" Text='&lt;%# Bind("Name") %&gt;'&gt;&lt;/asp:TextBox&gt; &lt;asp:ImageButton ID="ImageButton1" runat="server" CommandName="Update" ImageUrl="~/Images/save.gif" /&gt; &amp;nbsp; &lt;asp:ImageButton ID="ImageButton3" runat="server" CommandName="Cancel" ImageUrl="~/Images/cancel.gif" /&gt; &lt;/EditItemTemplate&gt; &lt;/cc1:ReorderList&gt; &lt;asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="&lt;%$ ConnectionStrings:MyConnectionString %&gt;" DeleteCommand="DELETE FROM [Milestones] WHERE [MilestoneID] = @MilestoneID" InsertCommand="INSERT INTO [Milestones] ([OrgID], [Name], [Priority]) VALUES (@OrgID, @Name, @Priority)" SelectCommand="SELECT MilestoneID, [Name], [Priority] FROM [Milestones] WHERE OrgID = @OrgID ORDER BY [Priority]" UpdateCommand="UPDATE [Milestones] SET [Name] = @Name, Priority = @Priority WHERE [MilestoneID] = @MilestoneID"&gt; &lt;SelectParameters&gt; &lt;asp:ProfileParameter Name="OrgID" PropertyName="OrgID" /&gt; &lt;/SelectParameters&gt; &lt;DeleteParameters&gt; &lt;asp:Parameter DbType="Guid" Name="MilestoneID" /&gt; &lt;/DeleteParameters&gt; &lt;UpdateParameters&gt; &lt;asp:Parameter Name="Priority" Type="Int32" /&gt; &lt;asp:Parameter Name="Name" Type="String" /&gt; &lt;asp:Parameter DbType="Guid" Name="MilestoneID" /&gt; &lt;/UpdateParameters&gt; &lt;InsertParameters&gt; &lt;asp:ProfileParameter Name="OrgID" PropertyName="OrgID" /&gt; &lt;asp:Parameter Name="Name" Type="String" /&gt; &lt;asp:Parameter Name="Priority" Type="Int32" /&gt; &lt;/InsertParameters&gt; &lt;/asp:SqlDataSource&gt; </code></pre> <p>Any ideas why the Name would get updated but the Priority would not?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload