Home > DeveloperSection > Beginner > PlaceHolder Control in Asp.Net

PlaceHolder Control in Asp.Net

ASP.Net ASP.Net 
0 Comment(s)
 5481  View(s)
Rate this:

PlaceHolder Control in ASP.Net

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

Don't want to miss updates? Please click the below button!

Follow MindStick