Click here to Skip to main content
15,890,557 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hey Guys, I have this problem, here it is,
I'm calling a user control programatically
C#
<pre>            using (Page page = new Page())
            {
                HtmlForm form = new HtmlForm();
                UserControl userControl = (UserControl)page.LoadControl("/UserControls/Products/ProductList.ascx");

                (userControl as BioPack.UserControls.Products.ProductList).initial(id);

                form.Controls.Add(userControl);
                using (StringWriter writer = new StringWriter())
                {
                    page.Controls.Add(form);
                    HttpContext.Current.Server.Execute(page, writer, false);
                    return writer.ToString();
                }
            }


Here's my user control

ASP.NET
<asp:DataList ID="DataListProductList" runat="server" RepeatColumns="4" Visible="false"
    Style="margin-right: 10px; height: auto;" OnItemDataBound="DataListProductList_ItemDataBound" OnItemCommand="DataListProductList_ItemCommand">
    <ItemTemplate>
        <div class="CategoryBox" style="removed: pointer; color: white; font-weight: bold; text-align: center">
            <asp:HiddenField ID="HiddenFieldID" Value='<%# Eval("pId") %>' runat="server"></asp:HiddenField>
            <asp:ImageButton ID="ImageProductMainButton" CssClass="ProductPicture" CommandName="LoadInfo" CommandArgument='<%# Eval("pId") %>' runat="server" />
            <div class="CategoryBoxText">
                <asp:Label Text='<%# Eval("pName") %>' runat="server" ID="LabelCategoryName" />
            </div>
        </div>
        <br />
    </ItemTemplate>
</asp:DataList>


<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <asp:Panel ID="PanelProductInfo" runat="server" Visible="false">
            <asp:Label ID="LabelProductInfo" runat="server" ForeColor="White" />
        </asp:Panel>
    </ContentTemplate>
</asp:UpdatePanel>



The problem is the update panel, without it it works fine, but when I include it, I get this error, please help me out
Error executing child request for handler 'System.Web.UI.Page'.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900