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<开发者_StackOverflow中文版/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!!
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.
精彩评论