ASP.NET AJAX部分回发没有屏幕更新

时间:2022-08-24 03:38:33

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.

我们的页面上有一个问题,即第一次按钮回发(我们有ASP.NET ajax以启用部分更新)没有任何反应,然后在每次后续点击时,信息都会更新,就像上一个事件被触发一样。

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.

3 个解决方案

#1


-1  

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

您的表可能在页面生命周期中太晚填充。尝试在PreInit中创建表。

#2


0  

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

您是否尝试过使用或不使用runat =“server”的HTML表格?

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

你在回发中添加或删除表格内的控件吗?

#3


0  

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.

你在哪个事件处理程序中构建表?如果你在Page_Load中构建它而不检查IsPostBack),那么按钮的click事件还没有被处理。

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

您需要在按钮单击处理程序中构建表。

#1


-1  

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

您的表可能在页面生命周期中太晚填充。尝试在PreInit中创建表。

#2


0  

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

您是否尝试过使用或不使用runat =“server”的HTML表格?

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

你在回发中添加或删除表格内的控件吗?

#3


0  

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.

你在哪个事件处理程序中构建表?如果你在Page_Load中构建它而不检查IsPostBack),那么按钮的click事件还没有被处理。

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

您需要在按钮单击处理程序中构建表。