Tuesday, November 20, 2007
If you open your existing Beta 2 web projects with VS 2008 RTM, and you were using the new ListView (one of the 3 new web controls), you may face the following error:
System.InvalidOperationException: An item placeholder must be specified on ListView 'ListView1'. Specify an item placeholder by setting a control's ID property to "itemPlaceholder". The item placeholder control must also specify runat="server".
There are two changes to be aware of:
1. Instead of
2. The control that has the
An example of both of the above:
System.InvalidOperationException: An item placeholder must be specified on ListView 'ListView1'. Specify an item placeholder by setting a control's ID property to "itemPlaceholder". The item placeholder control must also specify runat="server".
There are two changes to be aware of:
1. Instead of
itemContainer (which is probably what you are using from Beta 2), you must now change the id to be equal to itemPlaceholder. Make this change and your project will compile.2. The control that has the
id="itemPlaceholder" does not get rendered at runtime anymore (it gets removed and replaced with multiple instances of the ItemTemplate). So if you were using for example a ul and had some CSS on it for the li, this styling is now lost. The solution, of course, is to place the outer element (e.g. ul) on its own and within it place a asp:Placeholder whose ID you set to "itemPlaceholder".An example of both of the above:
<LayoutTemplate>Easy once you know how ;-)
<ul class="myCSSrule">
<asp:PlaceHolder ID="itemPlaceholder" runat="server" />
</ul>
</LayoutTemplate>
Labels: Orcas
Copyright © Daniel Moth


