Zhi-QiangNi's tech blog--AJAX's paradise
I'm working at the Microsoft IBS DevDiv Community Support Team, in charge of the customer service of ASP/AJAX forum. Welcome to my blog and AJAX forum, anyone interested in ASP.Net Ajax can discuss it with me. :-)
posts - 10,  comments - 24,  trackbacks - 1

Preface

ReorderList is an ASP.NET AJAX control that implements a bulleted, data-bound list with items that can be reordered interactively. To reorder the items in the list, the user simply drags the item's control bar to its new location. Graphical feedback is shown where the item will be placed as it is dragged by the user. The data source is updated after the item is dropped in its new location.

Sometimes we may need to handle the drag event to change the dragged item's style or popup some message after dropping it to a new location. Firstly, let's dig into the design code to find some useful handlers or events.

Background 

Code

Scenario

Here is a scenario. One customer placed a Command Button inside the ItemTemplate, then he can execute some operation in the server side command event. His target was to changing the selected item's style to specify it when clicking on the command button.

We need to split this goal into points:

  1. As the events of ReorderList are client side events, we need to change the style at client side.
  2. The ReorderList creates the DragVisual based on the dragged item including the style, so, we have to recover the original style of the items before dragging or after dropping.
  3. The command button would make a post back after clicking on it, so, we have to cache the selected item's index in the cookie, then, changing the style after page's reload at client side.

Code

Here is my detail code of this solution:

Code

 

Note

This is only a particular sample to handle the drag/drop event. You can modify it based on your own request. Feel free to discuss this UI with me here or in the ASP.NET Ajax Forum.

The related thread url: http://forums.asp.net/t/1380407.aspx


作者:Zhi-QiangNiZhi-QiangNi's Tech Blog
出处:http:// Zhi-QiangNi.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

0
0
(请您对文章做出评价)
« 上一篇:How to handle the Accordion's SelectedIndexChanged event at client side?
» 下一篇:How to build CustomControl with AjaxControlToolkit Control?
posted on 2009-02-12 12:35 Zhi-Qiang Ni 阅读(1164) 评论(5)  编辑 收藏 网摘 所属分类: ASP.NET AJAX UI, AjaxControlToolkit

FeedBack:
2009-02-12 17:03 | 痴情客      
in the client side development,drag&drop are very popular and useful;
in fact,has so many solutions yet,such as lightbox,shadowbox,drag.js..

http://www.scriptlover.com


  回复  引用  查看    
2009-02-12 17:04 | 痴情客      
of course,you give me a important documentation,helpful.
  回复  引用  查看    
#3楼[楼主]
2009-02-13 11:02 | Zhi-Qiang Ni      
@痴情客
Thanks, I read your site and blog, both of them are good places. You are a hard worker on the tech road. Cheer up!

  回复  引用  查看    
2009-02-16 15:13 | Timothy      
为什么这么牛啊,都是英文的,怎么学的。。可以把你的学习经历发表一下的。。
  回复  引用  查看    
#5楼[楼主]
2009-02-17 15:00 | Zhi-Qiang Ni      
--引用--------------------------------------------------
Timothy: 为什么这么牛啊,都是英文的,怎么学的。。可以把你的学习经历发表一下的。。
--------------------------------------------------------
Actually, every tech documentations or tutorials are written by English firstly as all the frameworks are established by foreigner. So, to learn .NET, the best way is researching it in the .NET's official website and MSDN. For learning ASP.NET AJAX, http://www.asp.net/ajax/ is a good place.

  回复  引用  查看    

<2009年2月>
25262728293031
1234567
891011121314
15161718192021
22232425262728
1234567

搜索

 

常用链接

我参与的团队

随笔分类

随笔档案

积分与排名

  • 积分 - 7296
  • 排名 - 7048

最新评论

阅读排行榜

评论排行榜