• ScriptManager和UpdatePanel控件


    在Ajax中当你要使用updatepanel控件时,首先要先拖一个scriptmanager控件。

      在updatepanel中updatemode与ChildrenAsTriggers怎样组合才不冲突呢?

           UpdateMode =Always    ChildrenAsTriggers =false(此种组合冲突)

           UpdateMode =Always    ChildrenAsTriggers =true (此种有效)

           UpdateMode =Conditional  ChildrenAsTriggers =true (此种有效)

           UpdateMode =Conditional  ChildrenAsTriggers =false(此种有效)

       不同的组合方式,不同的位置,显示出不同情况的刷新与跳转,如下一段代码(此处只显示一种组合一种位置的情况):

                <form id="form1" runat="server">
         <div id='time'><%=System .DateTime .Now.ToString () %>

          <asp:ScriptManager ID="ScriptManager1"  runat="server"></asp:ScriptManager>
        </div>
             <asp:UpdatePanel ID="UpdatePanel1" runat="server"  RenderMode =Block  UpdateMode =Always ChildrenAsTriggers =true     >
                <ContentTemplate>


                    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
                        ConnectionString="Data Source=.;Initial Catalog=B2B;User ID=sa;Password=sa"
                        ProviderName="System.Data.SqlClient"
                        SelectCommand="SELECT [ProductId], [ProductName], [ProductType], [ProductPrice], [ProductQuantity], [ProductAddress] FROM [Products]">
                    </asp:SqlDataSource>


                    <asp:GridView ID="GridView1" runat="server" AllowPaging="True"
                AutoGenerateColumns="False" DataKeyNames="ProductId"
                DataSourceID="SqlDataSource1" PageSize="15"  EnableViewState="False">
                        <Columns>
                            <asp:BoundField DataField="ProductId" HeaderText="ProductId"
                        InsertVisible="False" ReadOnly="True" SortExpression="ProductId" />
                            <asp:BoundField DataField="ProductName" HeaderText="ProductName"
                        SortExpression="ProductName" />
                            <asp:BoundField DataField="ProductType" HeaderText="ProductType"
                        SortExpression="ProductType" />
                            <asp:BoundField DataField="ProductPrice" HeaderText="ProductPrice"
                        SortExpression="ProductPrice" />
                            <asp:BoundField DataField="ProductQuantity" HeaderText="ProductQuantity"
                        SortExpression="ProductQuantity" />
                            <asp:BoundField DataField="ProductAddress" HeaderText="ProductAddress"
                        SortExpression="ProductAddress" />
                        </Columns>
                    </asp:GridView>


                    <asp:Button ID="Button1" runat="server" Text="Button"
        onclick="Button1_Click" />
       
                </ContentTemplate>
               
            </asp:UpdatePanel>
         
     <div  id="demo"> </div>
        </form>

      当updatemode=Always 时,

                    当botton按钮与GridView控件同在一个updatepanel中时,id为time的div时间不刷新,而gridview实现页面的跳转;

                    当botton按钮与GridView控件在两个updatepanel中时,id为time的div时间不刷新,而gridview实现页面的跳转;

                    当botton在id为demo的div中,gridview在updatepanel中时,id为time的div时间刷新,gridview实现页面的跳转;

     当updatemode=Conditional时,

                    当botton按钮与GridView控件同在一个updatepanel中时,id为time的div时间不刷新,而gridview实现页面的跳转;

                    当botton按钮与GridView控件在两个updatepanel中时,id为time的div时间不刷新,gridview也不实现页面的跳转;

                    当botton在id为demo的div中,gridview在updatepanel中时,id为time的div时间刷新,gridview实现页面的跳转;

                   

  • 相关阅读:
    Opengl编程指南第三章:视图
    OpenGL编程指南第四章:颜色
    OpenGL编程指南第七章:显示列表
    推荐:字体、排版简明入门
    OpenGL编程指南第八章:绘制像素、位图、字体和图像
    推荐:字体、排版简明入门
    OpenGL编程指南第五章:光照
    转载一篇密码学基本介绍
    ARM_异常和中断学习笔记
    ARM指令学习笔记
  • 原文地址:https://www.cnblogs.com/paper/p/1533048.html
Copyright © 2020-2023  润新知