The PlaceHolder Web server control does not have any visible output and is used as a place holder when we add controls at run time. The PlaceHolder control is used to reserve space for controls added by code.

<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>

PlaceHolder Control in ASP.Net

PlaceHolder is a container of other web server control

PlaceHolder Control in ASP.Net


<asp:PlaceHolder ID="PlaceHolder1" runat="server">
Search this website:
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Start Searching" />

The advantage of using PlaceHolder is that the textbox, button and other content contained within the PlaceHolder opening and closing HTML tags are kept as a single entity. For example, to hide the entire search form (i.e. text label, textbox and button) only a single line of C# code is required:

protected void Page_Load(object sender, EventArgs e)
        PlaceHolder1.Visible = false;

Now when run the project then all control will not show on the page because here PlaceHolder Visibility is false; and all control are inside PlaceHolder.


PlaceHolder Control in ASP.Net

  Modified On Mar-22-2018 07:26:50 AM

Leave Comment