Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1046888
  • 博文数量: 254
  • 博客积分: 10185
  • 博客等级: 上将
  • 技术积分: 2722
  • 用 户 组: 普通用户
  • 注册时间: 2007-07-25 15:04
文章存档

2011年(8)

2009年(1)

2008年(31)

2007年(214)

分类: 系统运维

2007-08-27 10:23:12

       UpdatePanelAnimationExtender控件用于在UpdatePanel发生更新时,产生动画效果。

下面来看一个示例:

1)在VS2005中新建一个ASP.NET AJAX-Enabled Web Project项目工程,命名为UpdatePanelAnimationExtender1。

2)在页面上拖放一个UpdatePanel,在其里拖放一个Label用于显示时间。然后再拖放3个CheckBox,用于设置不同的动画效果。

代码如下:

 1    
 2        
 3            
 4                
 5            

 6            
 7                
 8            

 9        
10         


11        

12        Choose the effects, then press 'Update':
13        Fade
14        Collapse
15        Color Background
16        
17        

3)然后在页面上拖放一个UpdatePanelAnimationExtender,用于控制动画效果。

代码如下:
       
           
               
                   
                        <%-- Store the original height of the panel --%>
                       
                        <%-- Disable all the controls --%>
                       
                           
                           
                           
                           
                       

                       
                        <%-- Do each of the selected effects --%>
                       
                           
                               
                           

                           
                               
                           

                           
                                                                    EndValue="#FF0000" StartValue="#40669A" />
                           

                       

                   

               

               
                   
                        <%-- Do each of the selected effects --%>
                       
                           
                               
                           

                           
                                <%-- Get the stored height --%>
                               
                           

                           
                                                                    StartValue="#FF0000" EndValue="#40669A" />
                           

                       

                        <%-- Enable all the controls --%>
                       
                           
                           
                           
                           
                       
                           
                   

               

           

       

4)对Page_load和"btnUpdate"按钮添加事件处理。
代码如下:
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                this.Label1.Text = DateTime.Now.ToString();
            }
        }

        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            this.Label1.Text = DateTime.Now.ToString();
        }
5)按下CTRL+F5,在浏览器中查看效果。
效果图如下:

阅读(2120) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~