Costa
Costa

Reputation: 4085

asp.net PlaceHolder usage

I found a programmer using a place holder like this

<asp:PlaceHolder ID="placeHolder4" runat="server">
  <asp:Repeater ID="repeaterSearchBookResults" runat=server>
          <HeaderTemplate>Code  </HeaderTemplate>


         <ItemTemplate> Code</ItemTemplate>

        <FooterTemplate> Code </FooterTemplate>
     </asp:Repeater>
</asp:PlaceHolder>

In the code, he did not add any controls, he did nothing except setting visible true to the place holder.

Is there some trick that I should know about place holders, or he is just too lazy to remove the place holder and use panels!!

Upvotes: 2

Views: 1255

Answers (1)

Heinzi
Heinzi

Reputation: 172220

The placeholder has the advantage that it does not render any HTML content itself; it just renders its contents. A panel, on the other hand, always wraps its contents in a (possibly unnecessary) <div> (or something similar, see the question linked below).

Related question: ASP.Net: Panel VS. PlaceHolder.

Upvotes: 4

Related Questions