每个更新面板上的用户控件都无法正确更新

时间:2013-07-21 20:48:57

标签: asp.net updatepanel

我在aspx页面上有两个用户控件。它们都有一个更新面板,UpdateMode属性设置为Conditional:

第一个是(VoteControl):

<asp:UpdatePanel ID="VoteUpdatePanel" runat="server" UpdateMode="Conditional">
  <ContentTemplate>
    <div class="vote">
      <div class="counter">
        <asp:Label ID="lblVoteCount" runat="server" />
      </div>
      <div class="vote-up">
        <asp:ImageButton ID="btnVote" runat="server" ImageUrl="~/App_Themes/DefaultTheme/images/br_up.png" OnClick="btnVote_Click" />
      </div>
    </div>
  </ContentTemplate>
  <Triggers>
    <asp:AsyncPostBackTrigger ControlID="btnVote" EventName="Click" />
  </Triggers>
</asp:UpdatePanel>

,另一个是(CommentControl),UpdatePanelAnimationExtender

<asp:UpdatePanel ID="CommentUpdatePanel" runat="server" UpdateMode="Conditional">
  <ContentTemplate>
    <asp:GridView ID="gvComments" runat="server" AutoGenerateColumns="false" ShowFooter="false"
      ShowHeader="false" GridLines="None" SkinID="SimpleGrid-noFormat">
      <Columns>
        <asp:TemplateField>
          <ItemTemplate>
            <div class="contents">
              <table style="width: 100%">
                <tr>
                  <td>
                    <%# "<b>" + Eval("AddedByName") + "</b>" %>
                    <%# Eval("CommentBody") %>
                  </td>
                  <td style="vertical-align: top; text-align: left; width: 70px; padding-right: 10px">
                    <div class="gravatar">
                      <ajaxToolkit:Gravatar ID="Gravatar1" runat="server" Width="64px" Height="64px" Email='<%# Eval("AddedByEmail") %>' />
                    </div>
                  </td>
                </tr>
              </table>
            </div>
          </ItemTemplate>
        </asp:TemplateField>
      </Columns>
    </asp:GridView>
    <asp:Panel ID="AddCommentPanel" runat="server">
      <div class="add-comment">
        <div id="mainComment">
          <asp:Panel ID="commentPanel" runat="server" ClientIDMode="Static">
            <div class="comment-title">
              <h2>Comments</h2>
            </div>
            <div>
              <asp:TextBox ID="txtCommentBody" runat="server" SkinID="FormatedTextBoxRtL" Width="99%" TextMode="MultiLine" Height="100px" />
              <div class="add">
                <asp:Button ID="btnSaveComment" runat="server" Text="Submit" SkinID="SimpleButton"
                  ValidationGroup="Comment" OnClick="btnSaveComment_Click" />
                <asp:HyperLink ID="HyperLink1" runat="server" Text="Discard" />
              </div>
            </div>
          </asp:Panel>
        </div>
        <div id="tanks">
          <asp:Panel ID="messagePanel" runat="server" Visible="false">
            <div>
              Thanks
            </div>
          </asp:Panel>
        </div>
      </div>
    </asp:Panel>
  </ContentTemplate>
  <Triggers>
    <asp:AsyncPostBackTrigger ControlID="btnSaveComment" EventName="Click" />
  </Triggers>
</asp:UpdatePanel>

<ajaxToolkit:UpdatePanelAnimationExtender ID="upae" runat="server" BehaviorID="animation" TargetControlID="CommentUpdatePanel"
  AlwaysFinishOnUpdatingAnimation="true">
  <Animations>
          <OnUpdating>
            <Sequence>
              <Parallel duration="0">
                  <EnableAction AnimationTarget="btnSaveComment" Enabled="false" />
              </Parallel>
              <Parallel duration=".25" Fps="30">
                <FadeOut AnimationTarget="comments" minimumOpacity=".2" />
              </Parallel>
            </Sequence>
          </OnUpdating>
          <OnUpdated>
            <Sequence>
              <Parallel duration=".25" Fps="30">
                  <FadeIn AnimationTarget="comments" minimumOpacity="1" />
              </Parallel>
              <Parallel duration="0">
                  <EnableAction AnimationTarget="comments" Enabled="true" />
              </Parallel> 
            </Sequence>
          </OnUpdated>
  </Animations>
</ajaxToolkit:UpdatePanelAnimationExtender>

所以,CommentControl工作正常,但当我点击btnVote上的VoteControl时,CommentControl开始更新并保持更新模式!所有代码都被触发了,当我刷新aspx页面时,每个东西看起来都很好(数据库生效)。
我不知道我错过了什么或者我的错是什么。你能帮帮我吗?

0 个答案:

没有答案