views:

595

answers:

3

We have an issue on our page whereby the first time a button posts back (we have ASP.NET ajax to enable partial updates) nothing happens, then on every subsequent click, the information is updated as if the previous event fired.

Here's the code for the page. The events are button clicks fired from within the table. Which is rerendered at the backend.

<asp:ScriptManager EnablePartialRendering="true" ID="scrptMgr1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel runat="server" ID="folderContainer">
        <ContentTemplate>
            <asp:Table id="FolderTable" CssClass="FolderTable" runat="server" CellSpacing="0"></asp:Table>
        </ContentTemplate>
    </asp:UpdatePanel>

Any ideas?

Thanks.

A: 

Did you try an HTML table, with or without runat="server" ?

Do you add or remove controls inside the table in the postback?

devio
Yes we completely rebuild the table within the postback
Rob Stevenson-Leggett
A: 

Your table is probably being populated too late in the page lifecycle. Try creating the table in PreInit.

Robert C. Barth
I've tried moving it to PreInit and the code goes through fine but now I get a blank page... odd.
Rob Stevenson-Leggett
why is this then the accepted answer?
devio
A: 

Inspired by Robert's answer:

In which event handler do you build your table? If you build it in Page_Load without checking IsPostBack), then the button's click event has not been handled yet.

You need to build the table in the button click handler.

devio