Atlas学习日记(一)

今天第一次用UpdatePanel,刚开始,不知道为什么不会实现局部刷新,看了好长时间,才知道,忘记设置EnablePartialRendering="True" ,这是<atlas:ScriptManager>的一个属性,但就是这个属性才能使UpdatePanel发挥强大的吸引力.

  下面是我的代码:

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
        <atlas:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="false" EnableScriptComponents="true" />
        <div>
            &nbsp; &nbsp;&nbsp;&nbsp;
           
            <atlas:UpdatePanel>
            <ContentTemplate>
            <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource2"
                DataTextField="CstName" DataValueField="CstName" AutoPostBack="True">
            </asp:DropDownList>
            </ContentTemplate>
           
            </atlas:UpdatePanel>
            <atlas:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
 <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:CPIC2_CSTConnectionString %>"
     SelectCommand="SELECT [CstName] FROM [Customer]"></asp:SqlDataSource>
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False"
        DataSourceID="SqlDataSource1" AllowSorting="True">
        <PagerSettings Mode="NextPreviousFirstLast" />
        <Columns>
            <asp:BoundField DataField="CstName" HeaderText="CstName" SortExpression="CstName" />
            <asp:BoundField DataField="Birth" HeaderText="Birth" SortExpression="Birth" />
            <asp:BoundField DataField="IndentityType" HeaderText="IndentityType" SortExpression="IndentityType" />
            <asp:BoundField DataField="Vocation" HeaderText="Vocation" SortExpression="Vocation" />
        </Columns>
    </asp:GridView>
               </ContentTemplate>
               <Triggers>
               <atlas:ControlValueTrigger  ControlID="DropDownList1" PropertyName="SelectedValue" />
              
               </Triggers>
              
             
            </atlas:UpdatePanel>
           
        
          
          
            &nbsp;
        </div>
    </form>

    <script type="text/xml-script">
        <page xmlns:script="http://schemas.microsoft.com/xml-script/2005">
            <references>
           
            </references>
            <components>
            </components>
        </page>
    </script>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:CPIC2_CSTConnectionString %>"
        SelectCommand="SELECT [CstName], [Birth], [IndentityType], [Vocation] FROM [Customer] where CstName=@CstName ">
        <SelectParameters>
       
        <asp:ControlParameter ControlID="DropDownList1" Name="CstName" Type="string" PropertyName="SelectedValue" />
        </SelectParameters>
      
    </asp:SqlDataSource>
    
</body>
</html>

转载于:https://www.cnblogs.com/sunlife/archive/2006/08/07/470226.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值