ASP.NET: "Object Required" when repeating LinkButtons in an UpdatePanel

Posted by MStodd on Stack Overflow See other posts from Stack Overflow or by MStodd
Published on 2009-06-18T22:25:27Z Indexed on 2010/04/05 13:03 UTC
Read the original article Hit count: 269

I have an UpdatePanel which has a Repeater repeating LinkButtons. When I click a LinkButton, the page does a partial postback, then I get a javascript error: "Object required". I tried debugging the javascript, but couldn't get a call stack. If I remove the UpdatePanel, the LinkButtons do a full postback, and they disappear from the page. How can I get this UpdatePanel to work?

<ajax:UpdatePanel ID="wrapperUpdatePanel" runat="server" UpdateMode="Always">
    <ContentTemplate>
        <asp:Repeater ID="endpointRepeater" runat="server" OnItemDataBound="EndpointDataBound">
            <HeaderTemplate>
                <div class="sideTabs">
                    <ul>
            </HeaderTemplate>
            <ItemTemplate>
                <li>
                    <asp:LinkButton ID="endpointLink" runat="server" OnClick="EndpointSelected" />
                </li>
            </ItemTemplate>
            <FooterTemplate>
                </ul>
                </div>
            </FooterTemplate>
        </asp:Repeater>
    </ContentTemplate>
</ajax:UpdatePanel>

binding code:

protected void Page_Load(object sender, EventArgs e)
{
    if (!this.IsPostBack)
    {
        this.SelectedEndpoint = Factory.Get<IEndpoint>(Enums.EndPoints.Marketing);
    }
    IEndpointCollection col = EndpointCollection.GetActivelySubscribingEndpointsForPart(this.Item);

    if (this.Item.IsGdsnItem)
        col.Add(Factory.Get<IEndpoint>(Enums.EndPoints.Gdsn));

    if (col.Count > 0)
        col.Insert(0, Factory.Get<IEndpoint>(Enums.EndPoints.Marketing));

    this.endpointRepeater.DataSource = col;
    this.endpointRepeater.DataBind();

    if (this.endpointRepeater.Items.Count > 0)
    {
        LinkButton lb = this.endpointRepeater.Items[0].FindControl("endpointLink") as LinkButton;
        this.EndpointSelected(lb, new EventArgs());
    }
}

thanks, mark

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about updatepanel