2
votes

Ok so I have an update panel sorrounding my controls. I have 2 dropdownlists which have functions they run from codebehind and a repeater of items. I've done the test in a Repeater using a button it doesn't do a postback, but the linkbutton does. What am I doing wrong?

also this is inside a usercontrol no aspx page.

<asp:UpdatePanel ID="upLocation" runat="server" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
<asp:Repeater ID="rptMuniProducts" runat="server">
    <HeaderTemplate>
        <table class="table">
            <thead>
                <tr>
                    <th class="w80"></th>
                    <th>Product</th>
                    <th>Product Type</th>
                 </tr>
             </thead>
             <tbody>
    </HeaderTemplate>
    <ItemTemplate>
                  <tr>
                     <td class="actions">
                      <asp:Button ID="btnProd" runat="server" OnClick="btnProd_Click" Text="test" />
                      <asp:LinkButton ID="lnkDeleteProd" runat="server" OnClick="lnkDeleteProd_Click">Link Test</asp:LinkButton>
                       <asp:HiddenField ID="hdnId" runat="server" Value='<%# DataBinder.Eval(Container, "DataItem.Id") %>' />
                      </td>
                      <td><%# DataBinder.Eval(Container, "DataItem.Name") %></td>
                      <td><%# DataBinder.Eval(Container, "DataItem.Producttype") %></td>
                    </tr>
     </ItemTemplate>
     <FooterTemplate>
                </tbody>
            </table>
     </FooterTemplate>
</asp:Repeater>
</ContentTemplate>
</asp:UpdatePanel>
1
There's nothing wrong and both the button and link buttons are posting back. If you set a breakpoint in Page_Load and see the value of IsPostBack, it is true for both controls. Your posted code is working fine as expected! - afzalulh
yes they both post back, but what i don't want is for the page to reload, and with the button the page doesn't reload and with linkbutton it does..thats the problem :( - Andres
You have to register the link button with ScriptManager. See here: stackoverflow.com/questions/8716362/… - Eugene S.
@EugeneS. I saw that but how do I get the scriptmanager from within the usercontrol? - Andres

1 Answers

1
votes

Have you tried setting ClientIDMode=Auto on the LinkButton? There's a long-standing .NET bug with doPostBack and non-auto client ids.