Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create delete button using <ajaxToolKit:ReorderList><DragHandleTemplat

Status
Not open for further replies.

BunBo900

MIS
Dec 11, 2009
50
US
Hello:

How can I create a delete button to remove a selected record? using <ajaxToolKit:ReorderList> and <DragHandleTemplate>? I saw a few samples but non of them have the delete capability. Is it possible at all? I am trying to modify the code below to be able to delete a selected record. Thanks.


---------MY CODE------------
<ajaxToolKit:ReorderList ID="ReorderList1" runat="server" PostBackOnReorder="false" DataSourceID="SqlDataSource1" CallbackCssStyle="callbackStyle" DragHandleAlignment="Left" ItemInsertLocation="Beginning" DataKeyField="id" SortOrderField="orderNumber">
<ReorderTemplate>
<asp:panel ID="Panel2" runat="server" Width="800px" CssClass="reorderCue" />
</ReorderTemplate>

<DragHandleTemplate>
<div style="cursor: move; background-color:#E2E3C2" class="dragHandle">
<table>
<tr>
<td valign="top">
<asp:Label ID="Label1" runat="server" Width="80px" Text='<%# HttpUtility.HtmlEncode(Convert.ToString(Eval("courseId"))) %>' />
</td>
<td valign="top">
<asp:Label ID="Label2" runat="server" Width="400px" Text='<%# HttpUtility.HtmlEncode(Convert.ToString(Eval("courseTitle"))) %>' />
</td>
</tr>
</table>
</div>
</DragHandleTemplate>
</ajaxToolKit:ReorderList>


<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$connectionStrings:dbConnectionString %>"

SelectCommand="SELECT [id], [studentId], [courseId], [courseTitle] FROM [tblQueue] WHERE studentId= @studentId Order By [orderNumber]"

UpdateCommand="UPDATE [tblQueue] SET [studentId] = @studentId, [courseId] = @courseId, [courseTitle] = @courseTitle, [orderNumber] = @orderNumber WHERE [id] = @id"

DeleteCommand="DELETE FROM [tblQueue] WHERE [id] = @id, [studentId] = @studentId, [courseId] = @courseId, [courseTitle] = @courseTitle, [orderNumber] = @orderNumber">

<SelectParameters>
<asp:SessionParameter SessionField="studentId" Name="studentId" Type="Int32" />
</SelectParameters>

<UpdateParameters>
<asp:parameter Name="CourseId" Type="String" />
<asp:parameter Name="courseTitle" Type="String" />
<asp:parameter Name="orderNumber" Type="Int32" />
<asp:parameter Name="id" Type="Int32" />
</UpdateParameters>

<DeleteParameters>
<asp:parameter Name="CourseId" Type="String" />
<asp:parameter Name="courseTitle" Type="String" />
<asp:parameter Name="orderNumber" Type="Int32" />
<asp:parameter Name="id" Type="Int32" />
</DeleteParameters>

</asp:SqlDataSource>
 
you would add a delete button like you would if there wasn't a reorder list. deleting a record is completely independent of sorting the UI.

Jason Meckley
Senior Programmer

faq855-7190
faq732-7259
My Blog
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top