Congratulations to all monthly winners of May 2013 !!! They have won INR 2900 cash and INR 27497 worth prize.
Go to DotNetFunda.com
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 28424 |  Welcome, Guest!   Register  Login
Home > Tutorials > ASP.NET Tutorials > PlaceHolder

Silverlight Tutorials | Report a Bug in the Tutorial
Found interesting? Add this to:


asp:PlaceHolder control
PlaceHolder control is used as a container in which other controls can be added dynamically.
 
Ads
PlaceHolder control is used as a container in which other controls can be added dynamically. This control has no HTML output, it is used only to load a control at a specific place on the page (Whereas Panel control has <div> as HTML output.)
DEMO : PlaceHolder Show Source Code

This contorl and outer HTML Table also added from Server side
This text is from user control and this user control has been loaded at runtime.
This is the example of PlaceHolder contorl.
 
// PlaceHolder Control //////////////////////////////////
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>

// Populates the PlaceHolder control //////////////////////////////////
private void PopulatePlaceHolder()
    {
        // Add ASP.NET Server Control
        TextBox txt1 = new TextBox();
        txt1.ID = "txt1";
        txt1.Width = 300;
        txt1.Text = "This control added from Server side.";
        PlaceHolder1.Controls.Add(txt1);

        // Add HTML controls
        string strHTML = "<hr /><table border='1'><tr><td>This contorl and outer HTML Table also added from Server side</td></tr><tr><td><input type='text' name='txtname' id='txtname' /></td></tr></table>";
        PlaceHolder1.Controls.Add(new LiteralControl(strHTML));
        
        // Add the usercontrol dynamically
        Control webUserControl = (Control)Page.LoadControl("~/tutorials/controls/controldata/WebUserControl.ascx");
        PlaceHolder1.Controls.Add(webUserControl);
    }
                    





About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 6/19/2013 6:35:38 AM