开发者

triggered button cause fullpostback

I've got an updatePanel and a button which triggered in it. However, the button causes full postback instead of partial one. Here's my Code:

<asp:Button ID="cEvent" runat="server" Text="&#1510;&#1493;&#1512; &#1497;&#1493;&#1501;" Width="80px" 
                    Height="40px" Font-Size="Medium" onclick="cEvent_Click" CausesValidation="false"/>

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
                    <asp:UpdatePanel id = "updatePanel1" runat="server" UpdateMode="Conditional">
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="cEvent" EventName="Click"/>
                        </Triggers>
                        <ContentTemplate>

                            <div id="yesEve" runat="server" visible="false" style="width:95%; float:right; margin-left:5%; padding-top:20px; margin-bottom:20px;">
                                <table id="mytable" cellspacing="0" runat="server">

                                </table>
                            </div>

                            <div id="errorMsg" runat="server" visible="false" style="width:100%; text-align:center; float:right;">
 开发者_StackOverflow社区                               <asp:label visible="true" ID="msg1" Font-Size="Medium" runat="server" Font-Bold="true" Text = "היום נמחק בהצלחה"></asp:label>
                            </div>

                            <div id="noEve" style="width:100%; padding-top:20px; float:right; text-align:center; margin-bottom:20px;" runat="server" visible="false">
                                <asp:label visible="true" ID="stamLabel" Font-Size="Medium" runat="server" Font-Bold="true" Text = "לא קיימים ימים פתוחים"></asp:label>
                            </div>

                            <asp:LinkButton ID ="remove" runat="server"></asp:LinkButton>

                        </ContentTemplate>
                    </asp:UpdatePanel>

I really need some help with that... i'm searching for hours all over the web to find an answer. Thanks, Matan


In the code behind, you can try adding this line:

ScriptManager.GetCurrent(Page).RegisterPostBackControl(Button1);   


There is nothing wrong with your code, you have a conflict somewhere with code(ClientIDs) you haven't show us or a JavaScript error breaking the page.


Here's a template for how to do this from a microsoft tutorial page:

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <fieldset>
        <legend>UpdatePanel</legend>
        <asp:Label ID="Label1" runat="server" Text="Panel created."></asp:Label><br />
        </fieldset>
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="Button1" />
    </Triggers>
</asp:UpdatePanel>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />

More information here:

microsoft tutorial

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜