惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Hacker News - Newest:
Hacker News - Newest: "LLM"
S
Security Affairs
PCI Perspectives
PCI Perspectives
Google Online Security Blog
Google Online Security Blog
W
WeLiveSecurity
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Recent Commits to openclaw:main
Recent Commits to openclaw:main
P
Privacy & Cybersecurity Law Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
S
Security @ Cisco Blogs
Security Archives - TechRepublic
Security Archives - TechRepublic
Cyberwarzone
Cyberwarzone
L
Lohrmann on Cybersecurity
TaoSecurity Blog
TaoSecurity Blog
V
Visual Studio Blog
博客园 - 聂微东
Scott Helme
Scott Helme
博客园 - 【当耐特】
K
Kaspersky official blog
Security Latest
Security Latest
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
MyScale Blog
MyScale Blog
Schneier on Security
Schneier on Security
WordPress大学
WordPress大学
博客园 - 叶小钗
C
Check Point Blog
V2EX - 技术
V2EX - 技术
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - Franky
T
Tor Project blog
Apple Machine Learning Research
Apple Machine Learning Research
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
腾讯CDC
雷峰网
雷峰网
博客园_首页
美团技术团队
Y
Y Combinator Blog
C
CERT Recently Published Vulnerability Notes
AWS News Blog
AWS News Blog
月光博客
月光博客
N
Netflix TechBlog - Medium
Last Week in AI
Last Week in AI
Recent Announcements
Recent Announcements
Google DeepMind News
Google DeepMind News
Help Net Security
Help Net Security
P
Proofpoint News Feed
MongoDB | Blog
MongoDB | Blog
C
Cybersecurity and Infrastructure Security Agency CISA

博客园 - .............

验证码生成器 十年编程无师自通 模仿桌面外观 Web服务是否失去前进目标 “开源”SOA正在改写IT规划方程式 C#实现的18位身份证格式验证算法 - ............. - 博客园 怎样使用Junit Framework进行单元测试的编写 从一个项目谈XP在国内的应用 - ............. - 博客园 AOP是什么? 在C#中使用Conditional元数据attribute来实现Debug代码 - ............. - 博客园 IBM CRM 系统解决方案 HR软件之我见-小议目前HR供应商 Atlas学习手记(11):使用ModalPopup Extender Atlas学习手记(10):使用AlwaysVisibleControl Extender Atlas学习手记(9):异步调用Page Method Atlas学习手记(8):调用本地Web Service简单介绍 Atlas学习手记(6):使用Atlas UpdateProgress控件 Atlas学习手记(5):使用服务端定时控件TimerControl Atlas学习手记(4):使用AutoComplete Extender实现自动完成功能 Atlas学习手记(3):由UpdatePanel开始
Atlas学习手记(7):使用DragOverlayExtender实现拖放功能
............. · 2006-08-03 · via 博客园 - .............

转自 TerryLee技术空间
DragOverlayExtender
允许我们对任何控件添加类似于Drag-and-Drop Behaviors那样的拖放(Drag-and-Drop)功能,更重要的是如果要对已经存在的控件添加,我们不需要对原有控件做任何的改动,只需添加一个DragOverlayExtender就可以轻松实现。

主要内容

1DragOverlayExtender介绍

2.完整示例

3.使用ProfileScriptService控件

一.DragOverlayExtender介绍

DragOverlayExtender允许我们对任何控件添加类似于Drag-and-Drop Behaviors那样的拖放(Drag-and-Drop)功能。更重要的是如果想对已经存在的控件添加,我们不需要对原有控件做任何的改动,只要添加一个DragOverlayExtender就可以轻松实现。DragOverlayExtender示例代码:

<atlas:DragOverlayExtender ID="doe1" runat="server">

    
<atlas:DragOverlayProperties TargetControlID="floatingLabel" ProfileProperty="FloatingLabelLocation"

        Enabled
="true" />

</atlas:DragOverlayExtender>

需要为DragOverlayExtender添加DragOverlayProperties来配置相关的拖放控件,它的属性如下:

属性

解释

TargetControlID

需要拖放控件的ID

TargetControlID="floatingLabel"

ProfileProperty

保存Profile,与ProfileScriptService控件结合使用

ProfileProperty="FloatingLabelLocation"

Enabled

是否可用

Enabled="true | false"

二.完整的示例

现在来看一个简单的拖放的例子,在这之前还是添加一个ScriptManager控件,这里并不需要设置EnablePartialRenderingtrue

<atlas:ScriptManager ID="scriptManager" runat="server">

</atlas:ScriptManager>

然后添加拖放区域,这里我们为一个Label控件添加拖放效果:

<div class="dropZone">

    
<asp:Label ID="floatingLabel" runat="server" CssClass="label">Please DragMe around</asp:Label>

</div>

现在添加DragOverlayExtender控件:

<atlas:DragOverlayExtender ID="doe1" runat="server">

</atlas:DragOverlayExtender>

再添加DragOverlayProperties来配置相关的控件,注意这步不能通过可视化的方式来实现,只能手工输入代码,设置TargetControlIDfloatingLabel

<atlas:DragOverlayExtender ID="doe1" runat="server">

    
<atlas:DragOverlayProperties TargetControlID="floatingLabel" 

        Enabled
="true" />

</atlas:DragOverlayExtender>

完成后完整的代码如下:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<html xmlns="http://www.w3.org/1999/xhtml">

<head id="Head1" runat="server">

    
<title>DragOverlay Extender Example</title>

    
<style type="text/css">

        body
{font-family:Verdana;}

        .label
{font-weight:bold;border:solid 1px Green;position: absolute}

        .dropZone
{height:200px;border:solid 1px Red;background:#efefef;}

    
</style>

</head>

<atlas:ScriptManager ID="scriptManager" runat="server">

</atlas:ScriptManager>

<body>

    
<form id="form1" runat="server">

        
<div class="dropZone">

            
<asp:Label ID="floatingLabel" runat="server" CssClass="label">Please DragMe around</asp:Label>

        
</div>

        
<atlas:DragOverlayExtender ID="doe1" runat="server">

            
<atlas:DragOverlayProperties TargetControlID="floatingLabel" 

                Enabled
="true" />

        
</atlas:DragOverlayExtender>

    
</form>

</body>

</html>

运行效果如下:

拖放:

三.使用ProfileScriptService控件

ASP.NET2.0提供了内置的Profile的支持,Atlas提供了一个ProfileScriptService控件可以使用我们轻松的使用Profile,如果要对前面例子中的拖放实现Profile,首先添加一个ProfileScriptService控件,可以设置是否自动保存:

<atlas:ProfileScriptService ID="profile1" runat="server" AutoSave="true">

</atlas:ProfileScriptService>

修改DragOverlayExtender为如下代码:

<atlas:DragOverlayExtender ID="doe1" runat="server">

    
<atlas:DragOverlayProperties TargetControlID="floatingLabel" ProfileProperty="FloatingLabelLocation"

        Enabled
="true" />

</atlas:DragOverlayExtender>

Web.config文件中启用Profile

<profileService enabled="true" setProperties="FloatingLabelLocation" getProperties="FloatingLabelLocation" />

并且要在<system.web>配置节中添加:

<profile  defaultProvider="AspNetSqlProfileProvider">

  
<properties>

    
<add name="FloatingLabelLocation" />

  
</properties>

</profile>

至此配置就完成了,感兴趣的朋友可以自己动手试验一下。

好了,关于DragOverlayExtender控件就到这里了,不过对于DragOverlayExtender来说好像不能限制拖放的区域,也许在Drag-and-Drop Behaviors中可以,慢慢再研究吧。

文中完整示例下载:https://files.cnblogs.com/Terrylee/DragOverlayExtenderDemo.rar