Terry82
关注Asp.net|SQL|XML|WebService|Javascript|CSS|OOP
Happy code!
博客园
首页
社区
新文章
新随笔
订阅
管理
posts - 5, comments - 3, trackbacks - 0
可拖动排序源码
在AjaxControlToolkit中有一个控件ReorderList可以实现拖动排序,它的示例程序用的是ObjectDataSource作数据源,而且数据没有保存到数据库中。我把它改成绑定到DataTable,并且数据是保存到数据库中。
以下是关键代码
protected
void
ReorderList1_ItemReorder(
object
sender,AjaxControlToolkit.ReorderListItemReorderEventArgs e)
{
String queryString
=
"
select * from Menu order by Priority asc
"
;
DataTable dt
=
GetData(queryString).Tables[
0
];
DataRowCollection rows
=
dt.Rows;
int
oldIndex
=
e.OldIndex;
int
newIndex
=
e.NewIndex;
string
SortOrderField
=
this
.ReorderList1.SortOrderField;
int
NewListOrder
=
(
int
)rows[newIndex][SortOrderField];
if
(oldIndex
<
newIndex)
//
item moved down
{
for
(
int
i
=
oldIndex
+
1
; i
<=
newIndex; i
++
)
{
rows[i][SortOrderField]
=
(
int
)rows[i][SortOrderField]
-
1
;
}
}
else
//
item moved up
{
for
(
int
i
=
oldIndex
-
1
; i
>=
newIndex; i
--
)
{
rows[i][SortOrderField]
=
(
int
)rows[i][SortOrderField]
+
1
;
}
}
rows[oldIndex][SortOrderField]
=
NewListOrder;
BatchUpdate(dt,
10
);
BindReorderList();
}
源码:
Reorder.rar
posted on 2007-05-24 11:15
Terry82
阅读(907)
评论(3)
编辑
收藏
网摘
FeedBack:
#1楼
2007-05-27 11:22 |
HELLO [未注册用户]
附加数据库时说microsoft SQL-DMO(ODBC SQLState: HY000)错误602: 未能在sysindexes中找到数据库id 7中对象id 1的索引id 1对应的行.请对sysindexes运行DBCC CHECKTABLE
回复
引用
#2楼
2007-05-30 09:09 |
luca623 [未注册用户]
不懂你源码中在修改方法中这段代码是什么意思~
adapter.UpdateCommand = new SqlCommand("UPDATE Menu SET Priority=@Priority WHERE ID=@ID;",connection);
adapter.UpdateCommand.Parameters.Add("@Priority", SqlDbType.Int, 4, "Priority");
adapter.UpdateCommand.Parameters.Add("@ID", SqlDbType.Int, 4, "ID");
回复
引用
#3楼
2007-06-07 14:01 |
wdx2008
不错,收藏了!好人,感谢!
回复
引用
查看
新用户注册
刷新评论列表
标题
姓名
主页
Email
(博主才能看到)
验证码
*
看不清,换一张
[
登录
][
注册
]
内容(请不要发表任何与政治相关的内容)
网站首页
新闻频道
社区
小组
博问
网摘
人才
找找看
Remember Me?
登录
使用高级评论
新用户注册
返回页首
恢复上次提交
[使用Ctrl+Enter键可以直接提交]
该文被作者在 2007-05-24 16:44 编辑过
Google站内搜索
相关文章:
相关链接:
最新IT新闻:
Google操作系统已开始内部测试?
Google阅读器界面升级 全新改版
微软官方下载:Windows Vista SP2 Beta测试版
微软发布PC Live单机游戏客户端
Firefox遭“独家”恶意软件攻击
<
2007年5月
>
日
一
二
三
四
五
六
29
30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
6
7
8
9
与我联系
发短消息
搜索
常用链接
我的随笔
我的空间
我的短信
我的评论
更多链接
我的参与
我的新闻
最新评论
我的标签
留言簿
给我留言
查看留言
随笔档案
2007年7月 (2)
2007年5月 (1)
2006年5月 (1)
文章分类
Ajax
Asp.net2.0
Asp.net内核(1)
Code Back(11)
搞笑(1)
学习笔记(2)
相册
精选图片
收藏夹
ActiveRecord(2)
Ajax
Mash-it Up with ASP.NET AJAX: Using a proxy to access remote APIs
Menu Control
Asp.net
__doPostBack and the Back Button
ASP.NET 2.0 Membership, Roles, Forms Authentication, and Security Resources
ASP.NET 2.0个性化配置(profile)[转] 以及本文个性化配置Demo代码下载
学习profile非常好的例子
Build a SqlSitemapProvider Treeview Navigation Control with SqlCacheDependency
Cascading Checkbox TreeView
Configuring ASP.NET 2.0 Application Services to use SQL Server 2000 or SQL Server 2005
Connect Your Site With HttpContext Items
Customizing generated Web Service proxies in Visual Studio 2005
根据配置生成代理类
Developer Notes for prototype.js
prototype使用文档
DHTML参考手册
Event Log RSS Feed Generator
How to add a Login, Roles and Profile system to an ASP.NET 2.0 app in only 24 lines of code
How To: Control Adapters
IEnumerable 和 IEnumerator 接口
Maintaining Fixed Headers in GridView
SHY520
Uploading Multiple Files At Once
Zip and Unzip files programmatically
Zip and Unzip files programmatically
个性化的弹出窗口
浅析class与struct区别
一步一步学Remoting之一:从简单开始
用IComparable来实现可排序的集合
自己写了一个Asp.net探针的源码,希望大家讨论一下
Code Back
Codeproject
Building Smart Client using .NET
Very Simple Solution
SmartClient :.NET Self Updating Applications
DataView|DataGrid....
Java
Inversion of Control Containers and the Dependency Injection pattern
Understanding JavaServer Pages Model 2 architecture
Javascript
Firefox插件FireBug
A good tool for View HTML Dom, CSS and Debug javascript
javascript 格式化工具
JScript Debugging in Visual Web Developer 2005
VS 2008 JavaScript Debugging
What ASP.NET Developers Should Know About JavaScript
超级简单好用的JS日期控件
MSDN
Error: URL Is In the Internet Zone
http://quickstarts.asp.net/QuickStartv20/aspnet/doc/caching/default.aspx
Using the Visual Studio .NET 2003 Debugger with ASP.NET Applications
PHP
IIS环境下快速安装、配置和调试PHP5.2.0
SQL2005
Get Identity Field and More From Inserts
Pagination In SQL Server 2005
SQL注入攻击:攻与防
使用 DataAdapter 执行批量更新
理论学习
ASP.NET2.0的控件状态和视图状态探讨 1
最新评论
阅读排行榜
1. 可拖动排序源码(907)
2. NHibernate问题,如何给赋空值(204)
3. 大文件上传下载解决办法(100)
4. 这样的流程图合格吗?(66)
评论排行榜
1. 可拖动排序源码(3)
2. 大文件上传下载解决办法(0)
3. 这样的流程图合格吗?(0)
4. NHibernate问题,如何给赋空值(0)