按钮未在更新面板中触发异步回发

时间:2011-10-14 18:52:28

标签: .net asp.net

我在更新面板中触发完整回发的按钮时出现问题,我无法弄清楚原因。

    <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
    <div class="VidVote">
    <ul class='star-rating'>
        <asp:Panel ID="CurrRate" runat="server"></asp:Panel>
        <li><asp:Button ID="OneCati" CssClass="one-star" runat="server" 
            onclick="OneCati_Click" CausesValidation="False" /></li>
        <li><asp:Button ID="TwoCati" CssClass="two-stars" runat="server" 
            onclick="TwoCati_Click" CausesValidation="False" /></li>
        <li><asp:Button ID="ThreeCati" CssClass="three-stars" runat="server" 
            onclick="ThreeCati_Click" CausesValidation="False" /></li>
        <li><asp:Button ID="FourCati" CssClass="four-stars" runat="server" 
            onclick="FourCati_Click" CausesValidation="False" /></li>
        <li><asp:Button ID="FiveCati" CssClass="five-stars" runat="server" 
            onclick="FiveCati_Click" CausesValidation="False" /></li>
    </ul>
    </div>
</ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="OneCati" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="TwoCati" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="ThreeCati" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="FourCati" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="FiveCati" EventName="Click" />
    </Triggers>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
    <div class="VidScore">
    <h3 style='text-align:center;margin-bottom:0; font-size:40px;'>
        <asp:Label ID="Score" runat="server" Text="Label"></asp:Label>
    </h3>
    </div>
</ContentTemplate>
</asp:UpdatePanel>

我尝试过我能想到的每一个面板组合,没有asp:AsyncPostBackTrigger

注意到 http://finalfantasyworld.net/dev/Movie/有效 http://dev.finalfantasyworld.net/Movie/无效

查看操作中的问题http://dev.finalfantasyworld.net/Movie/尝试评分

2 个答案:

答案 0 :(得分:1)

你有没有试过这样的事情?:

<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional" RenderMode="Inline"> 
    <Triggers> 
        <asp:AsyncPostBackTrigger ControlID="OneCati" EventName="Click" /> 
        <asp:AsyncPostBackTrigger ControlID="TwoCati" EventName="Click" /> 
        <asp:AsyncPostBackTrigger ControlID="ThreeCati" EventName="Click" /> 
        <asp:AsyncPostBackTrigger ControlID="FourCati" EventName="Click" /> 
        <asp:AsyncPostBackTrigger ControlID="FiveCati" EventName="Click" /> 
    </Triggers>
    <ContentTemplate> 
        <div class="VidVote"> 
        <ul class='star-rating'> 
            <asp:Panel ID="CurrRate" runat="server"></asp:Panel> 
            <li><asp:Button ID="OneCati" CssClass="one-star" runat="server"  
                onclick="OneCati_Click" CausesValidation="False" /></li> 
            <li><asp:Button ID="TwoCati" CssClass="two-stars" runat="server"  
                onclick="TwoCati_Click" CausesValidation="False" /></li> 
            <li><asp:Button ID="ThreeCati" CssClass="three-stars" runat="server"  
                onclick="ThreeCati_Click" CausesValidation="False" /></li> 
            <li><asp:Button ID="FourCati" CssClass="four-stars" runat="server"  
                onclick="FourCati_Click" CausesValidation="False" /></li> 
            <li><asp:Button ID="FiveCati" CssClass="five-stars" runat="server"  
                onclick="FiveCati_Click" CausesValidation="False" /></li> 
        </ul> 
        </div> 
        <div class="VidScore"> 
            <h3 style='text-align:center;margin-bottom:0; font-size:40px;'> 
                <asp:Label ID="Score" runat="server" Text="Label"></asp:Label> 
            </h3> 
        </div> 
    </ContentTemplate> 
</asp:UpdatePanel> 

答案 1 :(得分:0)

只需将您的异步触发器放在updatepanel2中并删除updatepanel1并将所有按钮放在更新面板之外,只有您的标签部分应该在updatepanle2中。让我知道你的结果..