Categories
Asp, Asp.net

An item placeholder must be specified on ListView ‘DataList1’. Specify an item placeholder by setting a control’s ID property to “itemPlaceholder”. The item placeholder control must also specify runat=”server”

An item placeholder must be specified on ListView ‘DataList1’. Specify an item placeholder by setting a control’s ID property to “itemPlaceholder”. The item placeholder control must also specify runat=”server”

Hi friends, recently i am working on a project and i am using ListView on one of my Webform. But on debug i am getting this error.

An item placeholder must be specified on ListView ‘DataList1’. Specify an item placeholder by setting a control’s ID property to “itemPlaceholder”. The item placeholder control must also specify runat=”server”

An item placeholder must be specified on ListView ListView1 Specify an item placeholder by setting a controls ID property to itemPlaceholder The item placeholder control must also specify runat server

To overcome this issue i googled following error, but not find any full proof solution, so i contact one of my senior. He told me to useĀ ItemPlaceHolder property and set to a control (mostly to a PlaceHolder control). So i tried following and it works for me.

<asp:ListView ID="Listview" runat="server" ItemPlaceholderID="myitemplaceholder">
<LayoutTemplate> 
<asp:PlaceHolder ID="myitemplaceholder" runat="server">
</asp:PlaceHolder>
</LayoutTemplate>
<ItemTemplate>

Earlier i am using it like this.

<asp:ListView ID="Listview" runat="server" >
<ItemTemplate></ItemTemplate>