This is a migrated thread and some comments may be shown as answers.

Ajax asp UpdatePanel inside RadGrid

1 Answer 231 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ronny
Top achievements
Rank 1
Ronny asked on 20 Dec 2011, 09:02 PM
I getting a error when I have a updatePanel inside RadGrid Control

Error description:
Cannot unregister UpdatePanel with ID 'udpItemOption' since it was not registered with the ScriptManager. This might occur if the UpdatePanel was removed from the control tree and later added again, which is not supported.
Parameter name: updatePanel

Code behind
 protected void grdWishList_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
                   switch (e.CommandName)
                    {
                        case "Remove":
                            int.TryParse(e.CommandArgument.ToString(), out _selectedIndex);
                            WishListPresenter presenter = (WishListPresenter)this.GetPresenter();
                            presenter.RemoveWishListItem();
                            pnlWishList.DataBind();
                            break;
                    }
        }

Page HTML Code:

    <div class="scWishListWrapper">
        <asp:Panel ID="pnlWishList" runat="server">
                    <div id="table-container" visible="<%# _hasWishListItems %>">
                        <telerik:RadGrid ID="grdWishList" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                            OnPageIndexChanged="grdWishList_PageIndexChanged" 
                            AllowSorting="true" SkinID="RadGrid" OnItemCommand="grdWishList_ItemCommand"
                            OnItemDataBound="grdWishList_ItemDataBound" OnPageSizeChanged="grdWishList_PageSizeChanged">
                            <MasterTableView AllowMultiColumnSorting="true" CommandItemDisplay="Bottom">
                                <Columns>
                                    <telerik:GridTemplateColumn SortExpression="RefProductNumber" ItemStyle-CssClass="GridItemOptionColum">
                                        <ItemTemplate>
                                            <uc3:wucItemOption runat="server" ID="wucItemOption1" ItemNumber='<%# Eval("ItemNumber") %>'
                                                RefProductNumber='<%# Eval("RefProductNumber")%>' AddToCartCommandName="AddToCart" />
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                </Columns>
                                <CommandItemSettings ShowRefreshButton="false" ShowAddNewRecordButton="false" ShowExportToWordButton="true"
                                    ShowExportToExcelButton="true" ShowExportToCsvButton="true" ShowExportToPdfButton="true" />
                            </MasterTableView>
                            <SortingSettings EnableSkinSortStyles="false" />
                            <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                            <ExportSettings ExportOnlyData="False" FileName="ExportedRadGrid" OpenInNewWindow="True"
                                IgnorePaging="True" />
                        </telerik:RadGrid>
                    </div>
                
        </asp:Panel>
    </div>

HTML wucItemOption:

<div class="scItemOption">
    <asp:UpdatePanel ID="udpItemOption" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <asp:Button SkinID="addtoCartButton" ID="lnkAddToCart" runat="server" Text="Add To Cart"/>
        </ContentTemplate>
    </asp:UpdatePanel>
</div>

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 21 Dec 2011, 11:14 AM
Hi Ronny,


Note that it is not supported scenario to have UpdatePanel added in the RadGrid control. You should wrap the whole RadGrid control with the UpdatePanel in order to avoid the described issue. Also if you need to set specific control to perform ajax and other regular postback you could set triggers for the UpdatePanel. Another option is to use RadAjaxManager partial ajaxification option as shown in the following online demo:
http://demos.telerik.com/aspnet-ajax/ajax/examples/manager/partialajaxification/defaultcs.aspx

 

Best wishes,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Grid
Asked by
Ronny
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or