|
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="CustomSort._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Sortable Demo</title>
<script type="text/javascript"
src="http://www.google.com/jsapi"></script>
<script language="javascript" type="text/javascript">
google.load("jquery", "1.3.2");
google.load("jqueryui", "1.7.2");
</script>
<script type="text/javascript"
src="http://www.json.org/json2.js"></script>
<SCRIPT type=text/javascript>
$(function() {
$("#sortable").sortable();
$("#sortable").disableSelection();
});
function update() {
var list = new Array();
$("ul").each(function(index, id) {
var result = $('#' + id.id).sortable('toArray');
var j = 0;
for (var i = 0; i < result.length; i++) {
list[j++] = $('#' + result[i])[0].value;
}
});
var jsonText = JSON.stringify({ list: list });
$.ajax({
type: "POST",
url: "Default.aspx/SaveData",
data: jsonText,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(res) {
$("#divResult").text(res.d);
}
});
}
</SCRIPT>
<style type="text/css">
ul.horizontal_list li{
text-align:left;
list-style: none;
padding: 3px 10px 3px 10px;
margin: 5px;
border: 1px solid #CCC;
width: 250px;
cursor : move;
}
</style>
</head>
<body>
<div id="divResult" style="color:red;"></div>
<asp:Panel ID="spaceHolder" runat="server" ></asp:Panel>
<input type="button" value="Update" onclick="javascript:update();" />
</body>
</html>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.