Reputation: 6605
My code looks like this:
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnAddIsotope" EventName="Click" />
</Triggers>
<ContentTemplate>
<asp:gridview id="gwResults" runat="server">
'all gridview columns go here
</asp:gridview>
<asp:ObjectDataSource here>
<asp:Panel id="pnlAddIso" runat="server">
<asp:Textbox ID="txtIsoDate" runat="server" />
<asp:Button ID="btnAdd" Text="Add " CssClass="button" runat="server" />
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
when i click the button, its supposed to add an item fromt he txtIsoDate into the database and refresh the gridview.
it adds fine, but when it comes back it creates another copy of my pnlAddIso.
why is this happening? i'm so confused. please help.
if im my button i write pnlAddIso.visible=false, the new duplicate panel does not appear, but the old one does not work anymore....
Upvotes: 6
Views: 6062
Reputation: 21
Try this
When you push a button, ajax duplicate some controls.
ScriptManager.GetCurrent(Page).RegisterPostBackControl(yourcontrol)
Upvotes: 0
Reputation: 360
I had the same problem but did not have any tables, what I did find were unclosed div tags, removed and fixed my problem
Upvotes: 14
Reputation: 423
I was also experiencing this issue and, as Servy said, the issue seemed to be related to tables. It wasn't consistent on every page.
The first thing I tries was to update the AjaxControlToolkit with NuGet.
In my case, a table encapsulated the update panel.
<table>
<asp:updatepanel .../>
</table>
I would look at your control or page, and check if any structure is being interrupted by anb update panel in this manner.
Upvotes: 2
Reputation: 6605
The issue was in tables.
I removed all table tags and now it works fine.
Upvotes: 1