/ Published in: C#
## Markup ##
_Using square [ ] brackets for compatibility with Snipplr comment form_
[asp:PlaceHolder ID="StuffHolder" runat="server" ]
<p>Some stuff in here</p>
[/asp:PlaceHolder]
## Code Behind ##
HtmlAttr[] attributes = {
new HtmlAttr("id","stuff"),
new HtmlAttr("class","container")
};
PlaceHolderToTag(StuffHolder, "div", attributes);
## Result ##
[div id="stuff" class="container"]
<p>Some stuff in here</p>
[/div]
### Notes:
Useful with the "Visible" property on the placeholder, and facilites
programmically setting IDs on DIVs (can set id based on some item name)
_Using square [ ] brackets for compatibility with Snipplr comment form_
[asp:PlaceHolder ID="StuffHolder" runat="server" ]
<p>Some stuff in here</p>
[/asp:PlaceHolder]
## Code Behind ##
HtmlAttr[] attributes = {
new HtmlAttr("id","stuff"),
new HtmlAttr("class","container")
};
PlaceHolderToTag(StuffHolder, "div", attributes);
## Result ##
[div id="stuff" class="container"]
<p>Some stuff in here</p>
[/div]
### Notes:
Useful with the "Visible" property on the placeholder, and facilites
programmically setting IDs on DIVs (can set id based on some item name)