Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update Panel duplicating my controls

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....

like image 272
Madam Zu Zu Avatar asked Feb 25 '11 19:02

Madam Zu Zu


3 Answers

I had the same problem but did not have any tables, what I did find were unclosed div tags, removed and fixed my problem

like image 169
Matthew Bierman Avatar answered Nov 02 '22 10:11

Matthew Bierman


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.

like image 2
gaijintendo Avatar answered Nov 02 '22 08:11

gaijintendo


The issue was in tables.

I removed all table tags and now it works fine.

like image 1
Madam Zu Zu Avatar answered Nov 02 '22 09:11

Madam Zu Zu