Please refer this code
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="http://code.jquery.com/ui/1.8.24/jquery-ui.min.js" type="text/javascript"></script>
<link href="http://code.jquery.com/ui/1.8.24/themes/blitzer/jquery-ui.css" rel="stylesheet"
type="text/css" />
<style type="text/css">
body
{
font-family: Arial;
font-size: 10pt;
}
.draggable
{
filter: alpha(opacity=60);
opacity: 0.6;
}
.dropped
{
position: static !important;
}
#dvSource, #dvDest
{
border: 5px solid #ccc;
padding: 5px;
min-height: 100px;
width: 430px;
}
</style>
<script type="text/javascript">
$(function () {
$("#DataList1 Table").draggable({
revert: "invalid",
refreshPositions: true,
drag: function (event, ui) {
ui.helper.addClass("draggable");
}
});
$("#dvDest").droppable({
drop: function (event, ui) {
if ($("#dvDest table").length == 0) {
$("#dvDest").html("");
}
ui.draggable.addClass("dropped");
$("#dvDest").append(ui.draggable);
$("#dvDest").append("<hr />");
}
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="dvSource">
<asp:DataList ID="DataList1" runat="server">
<ItemTemplate>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
Id
</td>
<td>
<asp:Label Text='<%# Eval("Id") %>' runat="server" />
</td>
</tr>
<tr>
<td>
Name
</td>
<td>
<asp:Label Text='<%# Eval("Name") %>' runat="server" />
</td>
</tr>
<tr>
<td>
Country
</td>
<td>
<asp:Label Text='<%# Eval("Country") %>' runat="server" />
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
</div>
<hr />
<div id="dvDest">
Drop here
</div>
</form>
</body>
</html>
Namespace
using System.Data;
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[3] { new DataColumn("Id", typeof(int)),
new DataColumn("Name", typeof(string)),
new DataColumn("Country",typeof(string)) });
dt.Rows.Add(1, "John Hammond", "United States");
dt.Rows.Add(2, "Mudassar Khan", "India");
dt.Rows.Add(3, "Suzanne Mathews", "France");
dt.Rows.Add(4, "Robert Schidner", "Russia");
DataList1.DataSource = dt;
DataList1.DataBind();
}
}
Screenshot
