How to call a panel and a web user control from teh server side?  I am using c#

Posted on 2008-11-05
Last Modified: 2013-11-07
Hi Experts!
I have a web user control called "WebUserControl.asxc" .Also I hace a page called"home.aspx".
I am trying to create  a "Panel" control from the  codebehind in"home.aspx" that can called "WebUserControl.asxc".

This is What I have so far...I create a panel and I give it an ID(Is this right?), now I need to call the webusercontrol and set it up inside the panel, how can I so this ? :
        Panel stepPanel = null;
        stepPanel.ID = "PanelInside";

Question by:eddyperu
    1 Comment
    LVL 4

    Accepted Solution

    This is the answer for aybody out there:
            Panel pnlECPopUp = new Panel();
            pnlECPopUp.ID = "pnlECPopUp";
            pnlECPopUp.CssClass = "modalPopup";
           // pnlECPopUp.Style.Value = "display: none";

            Control myControl = (Control)Page.LoadControl("controls/Exampletry.ascx");

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Hire Top Freelancers to Complete C# Projects

    Source the talented Expert Exchange community
    for top quality work on your C# projects.

    Hire the best. Collaborate easily. Get quality work.

    Suggested Solutions

    In my previous article ( we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
    More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now