atlas学习系列一(简单体验)

学习atlas有一段时间了,培训讲座也听了些,但是具体没有使用过,准备写一个atlas学习系列,从简单的开始,逐一学习总结一下atlas的 用法,本文介绍如何使用atlas来支持简单的无刷新效果。主要目的是体会一下atlas的强大功能。用的也是atlas官方demo,大家可以在它网站 上下载,自己只是简单重复的实践了一把。

1.母页

ContractedBlock.gif ExpandedBlockStart.gif
 1None.gif<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
 2None.gif
 3None.gif<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 4None.gif
 5None.gif<html xmlns="http://www.w3.org/1999/xhtml" >
 6None.gif<head runat="server">
 7None.gif    <title>无标题页</title>
 8None.gif</head>
 9None.gif<body>
10None.gif    <form id="form1" runat="server">
11None.gif     <div>任务列表</div>
12None.gif    <div>
13None.gif        <asp:contentplaceholder id="ContentPlaceHolder1" runat="server">                
14None.gif        </asp:contentplaceholder>
15None.gif    </div>
16None.gif    </form>
17None.gif</body>
18None.gif</html>
19None.gif

2.页面
None.gif <% @ Page Language = " C# "  MasterPageFile = " ~/MasterPage.master "  AutoEventWireup = " true "  CodeFile = " Default.aspx.cs "  Inherits = " _Default "  Title = " Untitled Page "   %>
None.gif
< asp:Content ID = " Content1 "  ContentPlaceHolderID = " ContentPlaceHolder1 "  Runat = " Server " >
None.gif
< atlas:ScriptManager ID = " ScriptManager1 "  runat = " server "  EnablePartialRendering = " true "   ></ atlas:ScriptManager >
None.gif
< div >
None.gif    
< asp:DropDownList ID = " DropDownList1 "  runat = " server "  AutoPostBack = " True " >
None.gif        
< asp:ListItem Value = " true " > Compeleted </ asp:ListItem >
None.gif        
< asp:ListItem Value = " false " > Active </ asp:ListItem >
None.gif    
</ asp:DropDownList >
None.gif    
< atlas:UpdateProgress ID = " UpdateProcess1 "  runat = " server " >
None.gif    
< ProgressTemplate > updateingdot.gif </ ProgressTemplate >
None.gif    
</ atlas:UpdateProgress >
None.gif
</ div >
None.gif
< div > 任务列表 - Grid形式 </ div >
None.gif
< div >
None.gif    
< atlas:UpdatePanel ID = " UpdatePanel1 "  runat = " server "  RenderMode = " Block "  Mode = " Always " >
None.gif    
< ContentTemplate >
None.gif    
< asp:GridView ID = " GridView1 "  runat = " server "  DataSourceID = " ObjectDataSource2 "  AllowPaging = " True "  AllowSorting = " True "  AutoGenerateColumns = " False "  CellPadding = " 4 "  DataKeyNames = " ID "  ForeColor = " #333333 "  GridLines = " None "  Width = " 422px " >
None.gif        
< FooterStyle BackColor = " #507CD1 "  Font - Bold = " True "  ForeColor = " White "   />
None.gif        
< Columns >
None.gif            
< asp:CommandField ShowDeleteButton = " True "  ShowEditButton = " True "   />
None.gif            
< asp:BoundField DataField = " ProjectName "  HeaderText = " ProjectName "  SortExpression = " ProjectName "   />
None.gif            
< asp:CheckBoxField DataField = " Compeleted "  HeaderText = " Compeleted "  SortExpression = " Compeleted "   />
None.gif        
</ Columns >
None.gif        
< RowStyle BackColor = " #EFF3FB "   />
None.gif        
< EditRowStyle BackColor = " #2461BF "   />
None.gif        
< SelectedRowStyle BackColor = " #D1DDF1 "  Font - Bold = " True "  ForeColor = " #333333 "   />
None.gif        
< PagerStyle BackColor = " #2461BF "  ForeColor = " White "  HorizontalAlign = " Center "   />
None.gif        
< HeaderStyle BackColor = " #507CD1 "  Font - Bold = " True "  ForeColor = " White "   />
None.gif        
< AlternatingRowStyle BackColor = " White "   />
None.gif    
</ asp:GridView >
None.gif    
</ ContentTemplate >
None.gif    
</ atlas:UpdatePanel >
None.gif    
< asp:ObjectDataSource ID = " ObjectDataSource2 "  runat = " server "  DeleteMethod = " Delete "
None.gif        InsertMethod
= " Insert "  OldValuesParameterFormatString = " original_{0} "  SelectMethod = " GetDataTable "
None.gif        TypeName
= " SimpleDemo1DataSet1TableAdapters.SimpleDemo1TableAdapter "  UpdateMethod = " Update "  EnableCaching = " True "  SqlCacheDependency = " AtlasDemoDb:SimpleDemo1 " >
None.gif        
< DeleteParameters >
None.gif            
< asp:Parameter Name = " Original_ID "  Type = " Int32 "   />
None.gif        
</ DeleteParameters >
None.gif        
< UpdateParameters >
None.gif            
< asp:Parameter Name = " ProjectName "  Type = " String "   />
None.gif            
< asp:Parameter Name = " Compeleted "  Type = " Boolean "   />
None.gif            
< asp:Parameter Name = " Original_ID "  Type = " Int32 "   />
None.gif        
</ UpdateParameters >
None.gif        
< SelectParameters >
None.gif            
< asp:ControlParameter ControlID = " DropDownList1 "  Name = " IsCompleted "  PropertyName = " SelectedValue "
None.gif                Type
= " Boolean "   />
None.gif        
</ SelectParameters >
None.gif        
< InsertParameters >
None.gif            
< asp:Parameter Name = " ProjectName "  Type = " String "   />
None.gif            
< asp:Parameter Name = " Compeleted "  Type = " Boolean "   />
None.gif        
</ InsertParameters >
None.gif    
</ asp:ObjectDataSource >
None.gif    
</ div >
None.gif
< div >
None.gif
< atlas:UpdatePanel ID = " UpdatePanel2 "  runat = " server "  Mode = " Conditional " >< ContentTemplate >
None.gif 
< asp:DetailsView ID = " DetailsView1 "  runat = " server "  Height = " 50px "  Width = " 423px "  AutoGenerateRows = " False "  BackColor = " White "  BorderColor = " #E7E7FF "  BorderStyle = " None "  BorderWidth = " 1px "  CellPadding = " 3 "  DataKeyNames = " ID "  DataSourceID = " ObjectDataSource2 "  GridLines = " Horizontal "  DefaultMode = " Insert " >
None.gif        
< FooterStyle BackColor = " #B5C7DE "  ForeColor = " #4A3C8C "   />
None.gif        
< EditRowStyle BackColor = " #738A9C "  Font - Bold = " True "  ForeColor = " #F7F7F7 "   />
None.gif        
< PagerStyle BackColor = " #E7E7FF "  ForeColor = " #4A3C8C "  HorizontalAlign = " Right "   />
None.gif        
< Fields >
None.gif            
< asp:BoundField DataField = " ID "  HeaderText = " ID "  InsertVisible = " False "  ReadOnly = " True "
None.gif                SortExpression
= " ID "   />
None.gif            
< asp:BoundField DataField = " ProjectName "  HeaderText = " ProjectName "  SortExpression = " ProjectName "   />
None.gif            
< asp:CheckBoxField DataField = " Compeleted "  HeaderText = " Compeleted "  SortExpression = " Compeleted "   />
None.gif            
< asp:CommandField ShowInsertButton = " True "   />
None.gif        
</ Fields >
None.gif        
< HeaderStyle BackColor = " #4A3C8C "  Font - Bold = " True "  ForeColor = " #F7F7F7 "   />
None.gif        
< AlternatingRowStyle BackColor = " #F7F7F7 "   />
None.gif        
< RowStyle BackColor = " #E7E7FF "  ForeColor = " #4A3C8C "   />
None.gif    
</ asp:DetailsView >
None.gif   
</ ContentTemplate >
None.gif   
< Triggers >< atlas:ControlValueTrigger ControlID = " DropDownList1 "  PropertyName = " SelectedValue "   /></ Triggers >
None.gif   
</ atlas:UpdatePanel >
None.gif
</ div >
None.gif
None.gif
</ asp:Content >
None.gif
None.gif
从页面代码中可以看出,主要涉及到atlas四个方面:
1.atlas:ScriptManager :我揣摩加上这个标签,页面就注册了一下调用服务器端ajax代码的js,从原文件中也可以看出,在相应位置,产生如下代码为:
<script src="/AtlasSimpleDemo1/WebResource.axd?d=3gMGO8vzpNXUSzrvQy_2DWGsjQkw1bBJAFDl2m1MpwDm2AZlxbopKEnT5eJLSEwvAiV62wgEk-T92L62_VXqXS2eRY-oB8mtk5RkTqZ5wSM1&amp;t=632870166220000000" type="text/javascript"></script>
<script src="atlasglob.axd" type="text/javascript"></script>
2.atlas:UpdateProgress , ProgressTemplate
生成一个div标签,以后更改div的visiable。
3。atlas:UpdatePanel
    a. ContentTemplate 我估计加上这种标签,相当于将该标签下的控件变成ajax控件,即交互都通过xmlhttp来实现。
    b.Triggers 这个标签用来处理页面事件。分为两类
      1)atlas:ControlValueTrigger : 控件值触发,比如设置控件为DropDownList1,源代码中就在DropDownList1控件生成的Select表单加上οnchange= "javascript:setTimeout('__doPostBack(\'ctl00$ContentPlaceHolder1$DropDownList1\',\'\')', 0)"如下语句。这样就可以触发该控件的事件了。
    2)atlas:ControlEventTrigger:估计是截取控件事件,将js方法写到指定方法中。
先写道这里,有空写下一篇。

转载于:https://www.cnblogs.com/jillzhang/archive/2006/08/15/477890.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值