研究Atlas(一)也做个无刷新

看了TerryLeeAtlas学习手记系列 ,自己动手做了第一个Demo。(太简单了,不适合放在这里 可以删调 ^_^)
环境:VS 2005 并安装了AtlasSetup.msi 关于AtlasSetup.msi的下载地址在我的首页下载连接中有。
atlas_1.gif

ContractedBlock.gif ExpandedBlockStart.gif CS代码
None.gifpublic partial class UpdatePanel : System.Web.UI.Page
ExpandedBlockStart.gifContractedBlock.gif
dot.gif{
InBlock.gif    
protected void Page_Load(object sender, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
this.Label1.Text = this.DropDownList1.SelectedValue;
InBlock.gif        
this.Label2.Text = this.DropDownList2.SelectedValue;
ExpandedSubBlockEnd.gif    }

InBlock.gif
InBlock.gif    
protected void Button1_Click(object sender, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
if (this.Label3.Text == "我是A!")
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.Label3.Text = "我是B,我怎么来这了?";
ExpandedSubBlockEnd.gif        }

InBlock.gif        
else
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.Label3.Text = "我是A!";
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

InBlock.gif    
protected void Button2_Click(object sender, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
if (this.Label4.Text == "我是B!")
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.Label4.Text = "我是A,我怎么来这儿了?";
ExpandedSubBlockEnd.gif        }

InBlock.gif        
else
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.Label4.Text = "我是B!";
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

 

ContractedBlock.gif ExpandedBlockStart.gif HTML代码
None.gif<html xmlns="http://www.w3.org/1999/xhtml" >
None.gif
<head runat="server">
None.gif    
<title>无标题页</title>
None.gif
</head>
None.gif
<body>
None.gif    
<form id="form1" runat="server">
None.gif        
<atlas:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True">
None.gif        
</atlas:ScriptManager>
None.gif    
<div id="DIV1" runat="server">
None.gif        
<table style="width: 404px; height: 161px" cellspacing=3 border=0 bgcolor=909090>
None.gif            
<tr bgcolor=e6e6e6>
None.gif                
<td style="width: 101px">
None.gif        我就不刷新:
</td>
None.gif                
<td style="width: 73px">
None.gif        
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" Width="100px">
None.gif            
<asp:ListItem>1</asp:ListItem>
None.gif            
<asp:ListItem>2</asp:ListItem>
None.gif            
<asp:ListItem>3</asp:ListItem>
None.gif        
</asp:DropDownList>
None.gif                    
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="轻轻的呼唤" /></td>
None.gif                
<td style="width: 100px">
None.gif        
<atlas:UpdatePanel ID="UpdatePanel1" runat="server" Mode="Always">
None.gif             
<Triggers>
None.gif                
<atlas:ControlValueTrigger  ControlID="DropDownList1"  PropertyName="SelectedValue"/>
None.gif            
</Triggers>
None.gif            
<ContentTemplate>
None.gif                          您选中了:
<asp:Label ID="Label1" runat="server" Width="69px" Font-Bold="True" ForeColor="Red"></asp:Label>
None.gif            
</ContentTemplate>
None.gif        
</atlas:UpdatePanel>
None.gif                    
None.gif          
<atlas:UpdatePanel ID="UpdatePanel2" runat="server" Mode="Always">
None.gif             
<ContentTemplate>
None.gif                 
<asp:Label ID="Label3" runat="server" Text="我是A!"></asp:Label>
None.gif             
</ContentTemplate>
None.gif             
<Triggers>
None.gif                 
<atlas:ControlEventTrigger  ControlID="Button1" EventName="Click"/>
None.gif             
</Triggers>
None.gif        
</atlas:UpdatePanel>
None.gif                
</td>
None.gif            
</tr>
None.gif            
<tr  bgcolor=e6e6e6>
None.gif                
<td style="width: 101px">
None.gif        我怎么总刷:
</td>
None.gif                
<td style="width: 73px">
None.gif                
<asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True"   Width="94px">
None.gif                    
<asp:ListItem>a</asp:ListItem>
None.gif                    
<asp:ListItem>b</asp:ListItem>
None.gif                    
<asp:ListItem>c</asp:ListItem>
None.gif                
</asp:DropDownList>
None.gif                    
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="给我使劲喊" /></td>
None.gif                
<td style="width: 100px">
None.gif                      您选中了:
<br/><asp:Label ID="Label2" runat="server" Text="Label" ForeColor="Red"></asp:Label>
None.gif                    
<br />
None.gif                    
<asp:Label ID="Label4" runat="server" Text="我是B!"></asp:Label></td>
None.gif            
</tr>
None.gif        
</table>
None.gif       
<br />
None.gif      
None.gif        
</div>
None.gif    
</form>
None.gif
</body>
None.gif
</html>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值