2012-06-11 43 views
0

下面是我的標記代碼,它在編譯時給了我錯誤消息。我已經在谷歌搜索了幾個小時,但不能幫助自己。什麼是我的標記中的incoorect代碼。 我對這個pagewhich一個CS文件數據綁定到這個列表視圖conrol使用列表視圖的PlaceHolder錯誤

任何幫助解決這一問題將是很大的幫助

錯誤消息:項佔位符必須在ListView的「ListView1的」指定。通過將控件的ID屬性設置爲「itemContainer」來指定項目佔位符。項目佔位符控件還必須指定runat =「server」。

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Attestation2.aspx.cs" Inherits="Attestation2" %> 

<!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 style="z-index: 1; left: 21px; top: 0px; position: absolute; height: 313px; 
    width: 983px"> 
    <form id="form1" runat="server"> 
    <div> 
     <asp:DropDownList ID="Entitlementdlist" runat="server" AutoPostBack="true" Visible="true" 
      ToolTip="All the Requests in this dropdown are Entitlement Requests only"> 
     </asp:DropDownList> 
     <%--asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>--%> 
     <asp:ListView ID="listview1" runat="server" ItemPlaceholderID="itemplaceholder" > 

      <ItemTemplate> 
       <table style="border:1px solid black;"> 
        <tr> 
         <td>Report Name</td> 
         <td><asp:TextBox ID="ReportNameLbl" runat="server" Text='<%#Eval("REPORT_DESCRIPTION.rptdesctext") %>' Width="500"></asp:TextBox> </td> 
         <td> 
         <asp:CheckBoxList ID="CheckBoxList1" runat="server" RepeatDirection="Horizontal"> 
          <asp:ListItem Text="Yes" Value="Yes"></asp:ListItem> 
           <asp:ListItem Text="No" Value="No"></asp:ListItem> 
          </asp:CheckBoxList> 
         </td> 
        </tr> 
        <tr> 
         <td>Content Description</td> 
         <td> 
         <asp:Label ID="ContentDescLbl" Text='<%#Eval("REPORT_REQUEST.StopLossMax") %>' runat="server" ></asp:Label> 
         </td> 
         <td> 
         <asp:CheckBoxList ID="CheckBoxList2" runat="server" RepeatDirection="Horizontal"> 
          <asp:ListItem Text="Yes" Value="Yes"></asp:ListItem> 
           <asp:ListItem Text="No" Value="No"></asp:ListItem> 
          </asp:CheckBoxList> 
         </td> 




        </tr> 
        <tr> 

        <td> 
        Frequency 
        </td> 
        <td> 
        <asp:Label ID="frequencyLbl" Text='<%#Eval("REPORT_REQUEST.reportfrequency") %>' runat="server" ></asp:Label> 
        </td> 
        <td> 
        <asp:CheckBoxList ID="CheckBoxList3" runat="server" RepeatDirection="Horizontal"> 
          <asp:ListItem Text="Yes" Value="Yes"></asp:ListItem> 
           <asp:ListItem Text="No" Value="No"></asp:ListItem> 
          </asp:CheckBoxList> 
        </td> 
        </tr> 
        <tr> 
        <td> 
        Recepients 
        </td> 
        <td colspan="2"> 
        <td> 
        <asp:ListView ID = "lstview2" runat = "server" > 
        </asp:ListView> 
        </td> 
        </td> 
        </tr> 
       </table> 

       </asp:Table>--%> 
      </ItemTemplate> 
     </asp:ListView> 
    </div> 
    </form> 
</body> 
</html> 

回答

2

裏面你的ListView你已經加入一個包含佔位符LayoutTemplate模板:

<asp:ListView ID="listview1" runat="server" ItemPlaceholderID="itemplaceholder" > 
    <LayoutTemplate> 
     <asp:PlaceHolder ID="itemplaceholder" runat="server" /> 
    </LayoutTemplate> 
    <ItemTemplate> 
     ... 
    </ItemTemplate> 
</asp:ListView> 
+0

謝謝你這麼多 –