通过设置控件的ID属性QUOT&指定项占位符; itemPlaceholder" [英] Specify an item placeholder by setting a control's ID property to "itemPlaceholder"
问题描述
我只有单一的的Default.aspx页面和一个ListView控件。为什么会出现这种错误。以前从来没有发生过。
I have only single "Default.aspx" page and a single ListView Control. Why am I getting this error. Never Happened before
的项目占位符必须在ListView的ListView1的指定。通过设置控件的ID属性指定项目占位符itemPlaceholder项占位符控件还必须指定=服务器。
"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"."
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TesterConcepts._Default"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
onselecting="ObjectDataSource1_Selecting" SelectMethod="GetItemsCollection"
TypeName="TesterConcepts.CutomDataSource">
<SelectParameters>
<asp:Parameter Name="items" Type="Object" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:ListView ID="ListView1" runat="server" DataSourceID="ObjectDataSource1"
onselectedindexchanged="ListView1_SelectedIndexChanged">
</asp:ListView>
</body>
</html>
这样做是无益甚至
doing this was not helpful even
<asp:ListView ID="ListView1" runat="server" DataSourceID="ObjectDataSource1"
OnSelectedIndexChanged="ListView1_SelectedIndexChanged"
ItemPlaceholderID="PlaceHolder1">
</asp:ListView>
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
现在它抛出这个异常
PLACEHOLDER1的项目占位符必须在ListView的ListView1的指定。通过设置控件的ID属性来指定项占位符。项占位符控件还必须指定=服务器,
"An item placeholder must be specified on ListView 'ListView1'. Specify an item placeholder by setting a control's ID property to "PlaceHolder1". The item placeholder control must also specify runat="server""
推荐答案
看起来你需要定义的项目元素该查询将返回占位元素结构。
Looks like you need to define the placeholder element structure for the item elements which the query will return.
我建议你阅读这篇文章。有点老了,但说明了这个概念。
<一href=\"http://www.4guysfromrolla.com/articles/122607-1.aspx\">http://www.4guysfromrolla.com/articles/122607-1.aspx
I'd suggest reading this article. A little old, but illustrates the concept. http://www.4guysfromrolla.com/articles/122607-1.aspx
这篇关于通过设置控件的ID属性QUOT&指定项占位符; itemPlaceholder&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!