Click here to Skip to main content
11,921,898 members (39,591 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP User-controls
Hey Guys, I have this problem, here it is,
I'm calling a user control programatically
<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);
                using (StringWriter writer = new StringWriter())
                    HttpContext.Current.Server.Execute(page, writer, false);
                    return writer.ToString();

Here's my user control

<asp:DataList ID="DataListProductList" runat="server" RepeatColumns="4" Visible="false"
    Style="margin-right: 10px; height: auto;" OnItemDataBound="DataListProductList_ItemDataBound" OnItemCommand="DataListProductList_ItemCommand">
        <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" />
        <br />

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

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 28-Mar-13 23:49pm

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

  Print Answers RSS
0 OriginalGriff 493
1 Dave Kreskowiak 285
2 Sergey Alexandrovich Kryukov 243
3 Richard MacCutchan 155
4 ppolymorphe 135
0 OriginalGriff 7,231
1 KrunalRohit 4,530
2 Sergey Alexandrovich Kryukov 3,356
3 George Jonsson 2,865
4 Suvendu Shekhar Giri 2,216

Advertise | Privacy | Mobile
Web01 | 2.8.151120.1 | Last Updated 29 Mar 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100