Atlas讲座(1)- UpdatePanel控件(代码)

1. Dome
l CS 文件
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class UpdatePanelDome : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void bt_Change_Click(object sender, EventArgs e)
{
for (int i = 0; i < 100000; i++)
{
}
this.lb_Text.Text = " 你选择的值是:" + ddl_Value.SelectedValue;
}
protected void ddl_Value_TextChanged(object sender, EventArgs e)
{
}
protected void ddl_Value_SelectedIndexChanged(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(1000);
this.lb_Text.Text = " 你选择的值是:" + ddl_Value.SelectedValue;
}
}
l ASPX 文件
<% @ Page Language="C#" AutoEventWireup="true" CodeFile="UpdatePanelDome.aspx.cs" Inherits="UpdatePanelDome" %>
<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< html xmlns="http://www.w3.org/1999/xhtml" >
< head runat="server">
<title> 无标题页</title>
</ head >
< body >
<form id="form1" runat="server">
<div>
<atlas:ScriptManager ID="ScriptManager1" EnablePartialRendering="true" runat="server">
</atlas:ScriptManager>
&nbsp;&nbsp;
<br />
<atlas:UpdatePanel ID="up" runat="server">
<ContentTemplate>
<asp:DropDownList ID="ddl_Value" runat="server" OnSelectedIndexChanged="ddl_Value_SelectedIndexChanged" OnTextChanged="ddl_Value_TextChanged">
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
<asp:ListItem>5</asp:ListItem>
</asp:DropDownList>
<asp:Label ID="lb_Text" runat="server"></asp:Label>
<br /><asp:Button ID="bt_Change" runat="server" Text=" 获取" OnClick="bt_Change_Click" />
</ContentTemplate>
<Triggers>
<atlas:ControlValueTrigger ControlID="ddl_Value" PropertyName="SelectedValue" />
<atlas:ControlEventTrigger ControlID="bt_Change" EventName="Click" />
</Triggers>
</atlas:UpdatePanel>
</div>
</form>
</ body >
</ html >
最后
在下一期的讲座里我们介绍下 ATLAS 的绑定技术

你可能感兴趣的:(Web,UI,XHTML,Security,asp)