tags:

views:

38

answers:

4

I have a simple html table tag with 2x2 cells on my ascx. There are two textbox control inside. I wrapped the table by a ajaxPanel.

Outside the ajaxPanel, I have a button, and onclick event will set the value of two textbox to "1".

But after click the button, I found the value is set with postback.

Please advice~

A: 

I think you're missing the in your html/aspx file.

Go there for more information: Asp.net updatepanel overview.

Matias
A: 

You should place your button inside the update panel as well.

Coderuckus
A: 

Place the button inside the update panel, or add the button as async postback trigger to the update panel, change the update mode of the panel to Conditional.

A: 

This example will work without having the button inside the update panel:

    <asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
        <ContentTemplate>
            <table>
                <tr>
                    <td>Text1:</td>
                    <td><asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></td>
                </tr>
                <tr>
                    <td>Text2:</td>
                    <td><asp:TextBox ID="TextBox2" runat="server"></asp:TextBox></td>
                </tr>
            </table>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="Button1" />
        </Triggers>
    </asp:UpdatePanel>

    <asp:Button runat="server" ID="Button1" Text="Button" onclick="Button1_Click" />
awe