2

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!!

Costa
  • 3,897
  • 13
  • 48
  • 81
  • Hi Costa, Repeater is a server control, earlier than GridView in asp.net we have repeaters. Also placeholders act as a container so he placed repeater inside that, bcoz of the placeholders do not generates hTML –  Mar 31 '11 at 08:17

1 Answers1

4

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.

Community
  • 1
  • 1
Heinzi
  • 167,459
  • 57
  • 363
  • 519