Go to DotNetFunda.com
<<= Please see left side tutorials menu.


Silverlight Tutorials | Report a Bug in the Tutorial

Found interesting? Add this to:

| More

asp:PlaceHolder control
PlaceHolder control is used as a container in which other controls can be added dynamically.
 
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 | The Team | Advertise | Contact Us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you found 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. | 9/7/2010 12:41:12 AM