A group placeholder must be specified on ListView

Now this is even more tricky than An item placeholder must be specified on ListView. For Visual Studio 2008 RTM Microsoft changed the whole GroupTemplate Design structure.

This MSDN Article is covering it pretty good, here’s what you have to do if you switched from Visual Studio 2008 Beta 2 to Visual Studio 2008 RTM:

1) Remove the ItemPlaceholderID=”xx” from your ListView, it should look like that (e.g.):

<asp:ListView ID=”ListView1″ runat=”server” DataKeyNames=”picID” DataSourceID=”LinqDataSource1″ GroupItemCount=”4″>

2) Have a LayoutTemplate organized like that:

<Layouttemplate>
<table align=”center” border=”0″ cellpadding=”15″ cellspacing=”15″ id=”layoutTemplate” runat=”server”>
<tr runat=”server” id=”groupPlaceholder” />
</table>
</Layouttemplate>

3) And a GroupTemplate in that kind of style:

<GroupTemplate>
<tr runat=”server” id=”ProductsRow”>
<td runat=”server” id=”itemPlaceholder” />
</tr>
</GroupTemplate>

That’s all. If you try to set the new GroupPlaceHolderID in the ListView Tag the GroupTemplates won’t be formated correctly, I didn’t figure out why yet. This solution however is based on the MSDN Article and works.

1 comment so far ↓

#1 Ten Tips for a Happy Upgrade to Visual Studio 2008 (Release) - Jon Galloway on 11.28.07 at 11:18 am

[…] Daniel Moth has some info on this, Andreas Kraus explains the issue for both the Item Placeholder and the Group Placeholder. […]

Leave a Comment