Yeah, to make things clear, my objective was to be able to show the same module different ways:
- general layout was to show listview items in usual over-under order,
- specific layout, where listview items would appear in side-by-side manner.
There are other criteria to show/hide like showing dates and categories, as well as number of items to show. All are managed by module's TabSettings.
So what I did was:
ASCX:
<asp:ListView ID="LV_Main" runat="server">
<ItemTemplate>
<div id="EntryWrapper" runat="server" class="divEntryWrapper">
...
</div>
</ItemTemplate>
<LayoutTemplate>
<div ID="itemPlaceholderContainer" runat="server">
<span runat="server" id="itemPlaceholder" />
</div>
</LayoutTemplate>
Code Behind:
Protected Sub LV_Main_LayoutCreated(sender As Object, e As System.EventArgs) Handles LV_Main.LayoutCreated
Dim itemPlaceholderContainer As HtmlControl = DirectCast(sender.FindControl("itemPlaceholderContainer"), HtmlControl)
itemPlaceholderContainer.Attributes.Add("class", "GeBlogPage" & TabId.ToString)
End Sub
I've put the logic into the code-behind as putting it directly into the ASCX didn't work for some reason.
module.css
/* General Layout */
.divEntryWrapper
{
border-style: solid;
border-width: 1px;
-moz-border-radius: 7px;
border-radius: 7px;
margin-bottom: 2em;
}
/*Page specific layout */
.GeBlogPage55 .divEntryWrapper
{
border-style: solid;
border-width: 1px;
display: inline-block;
width: 19.5%;
text-align:center;
word-wrap: break-word;
}
The example above for page specific layout assumes the TabId=55.
Hope this helps!