asp.net ajax技巧6

  今天继续学习章立民的书。讲到两个updatepannel的嵌套。比如下面的例子
   <asp:ScriptManager ID="ScriptManager" runat="server" />
            <asp:UpdatePanel ID="OuterPanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="False">
                <ContentTemplate>
                    <div>
                        <fieldset style="width: 510px">
                            <legend>外层 UpdatePanel -
                                <br />
                                UpdateMode = Conditional , ChildrenAsTriggers = False</legend>
                            <br />
                            <asp:Button ID="BtnOuter" Text="外层 UpdatePanel 中的按钮" runat="server" Width="248px" />
                            <br />
                            更新时间
                            <%= DateTime.Now.ToString() %>
                            <br />
                            <br />
                            <asp:UpdatePanel ID="InnerPanel" runat="server" UpdateMode="Conditional">
                                <ContentTemplate>
                                    <div class="NestedPanel">
                                        <fieldset>
                                            <legend>内层 UpdatePanel -
                                                <br />
                                                UpdateMode = Conditional , ChildrenAsTriggers = True<br />
                                                AsyncPostBackTrigger ControlID = BtnOuter EventName = Click</legend>
                                            <br />
                                            更新时间
                                            <%= DateTime.Now.ToString() %>
                                            <br />
                                            <asp:Button ID="BtnInner" Text="内层 UpdatePanel 中的按钮" runat="server" Width="248px" />
                                        </fieldset>
                                    </div>
                                </ContentTemplate>
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="BtnOuter" EventName="Click" />
                                </Triggers>
                            </asp:UpdatePanel>
                        </fieldset>
                    </div>
                </ContentTemplate>
            </asp:UpdatePanel>
 上面中,如果外层的button点击后,只想内层的区域更新,但外层的区域不被更新的话,可以象上面那样设置好触发器

你可能感兴趣的:(Ajax,.net,asp.net,asp)