Matan Kadosh
Matan Kadosh

Reputation: 1781

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;">
                                <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

Upvotes: 0

Views: 114

Answers (3)

rick schott
rick schott

Reputation: 20617

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.

Upvotes: 1

James Johnson
James Johnson

Reputation: 46047

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

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

Upvotes: 1

Dmitry Samuylov
Dmitry Samuylov

Reputation: 1564

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

Upvotes: 0

Related Questions