2013-07-17 3 views
5

il codice:Il controllo RadListView non ha un segnaposto elemento specificato

<telerik:RadListView ID="RadListView1" Width="100%" AllowPaging="True" runat="server" 
      Skin="Metro" allowsorting="true" ItemPlaceholderID="ProductsHolder" DataKeyNames="Product_ID" GroupPlaceholderID="CategoryHolder" 
      GroupItemCount="4" > 
      <GroupTemplate> 
       <fieldset style="float: left; width: 330px; margin-right: 15px;"> 
        <legend><%#Eval("CATEGORY_NAME") %></legend> 
        <table> 
         <tr> 
          <td> 
           <asp:Panel ID="CategoryHolder" runat="server"></asp:Panel> 

          </td> 
         </tr> 
        </table> 
       </fieldset> 


      </GroupTemplate> 

      <LayoutTemplate> 
       <fieldset style="width: 100%; margin: 0 auto; border: none;" id="FieldSet1"> 
        <telerik:RadDataPager ID="RadDataPager2" runat="server" PagedControlID="RadListView1" 
         Visible='<%# Container.PageCount != 1%>' Skin="Metro" PageSize="52"> 
         <Fields> 
          <telerik:RadDataPagerButtonField FieldType="FirstPrev" FirstButtonText="First" PrevButtonText="Prev" 
           HorizontalPosition="LeftFloat" /> 
          <telerik:RadDataPagerButtonField FieldType="Numeric" /> 
          <telerik:RadDataPagerButtonField FieldType="NextLast" NextButtonText="Next" LastButtonText="Last" 
           HorizontalPosition="RightFloat" /> 
         </Fields> 
        </telerik:RadDataPager> 
        <br /> 
        <asp:Panel ID="ProductsHolder" runat="server"> 
        </asp:Panel> 
        <table cellpadding="0" cellspacing="4" width="100%;" style="clear: both;"> 
         <tr> 
          <td> 
           <telerik:RadDataPager ID="RadDataPager1" runat="server" PagedControlID="RadListView1" 
            Visible='<%# Container.PageCount != 1%>' Skin="Metro" PageSize="52"> 
            <Fields> 
             <telerik:RadDataPagerButtonField FieldType="FirstPrev" FirstButtonText="First" PrevButtonText="Prev" 
              HorizontalPosition="LeftFloat" /> 
             <telerik:RadDataPagerButtonField FieldType="Numeric" HorizontalPosition="NoFloat" /> 
             <telerik:RadDataPagerButtonField FieldType="NextLast" NextButtonText="Next" LastButtonText="Last" 
              HorizontalPosition="RightFloat" /> 
            </Fields> 
           </telerik:RadDataPager> 
          </td> 
         </tr> 
        </table> 
       </fieldset> 
      </LayoutTemplate> 
      <EmptyDataTemplate> 
       <div style="width: 100%; text-align: center;"> 
        <b>No Results Found</b></div> 
      </EmptyDataTemplate> 
      <ItemTemplate> 
       <div style="float: left; padding-bottom: 20px; padding-left: 10px; padding-right: 10px;"> 
        <div class="CardItem" style="margin: auto !important;"> 
         <div class="cardDisplay"> 
          <img src="../App_Themes/VivaTheme/images/loading_big.gif" alt="" onerror="javascript:this.onerror = null;this.src='../images/Orders/VivaNotAvailable.jpg';" 
           onload="RetrievePicture(this,'<%# Eval("PRODUCT_ID")%>');" class="lof-image" 
           width="180" height="117" style="margin-bottom: 5px;" /> 
         </div> 
         <div class="points"> 
          <%# DataBinder.Eval(Container.DataItem, "SALES_PRICE", "{0:###,###,###,##0.00}") + " " + Eval("CURRENCY_ABREVIATION")%> 
         </div> 
         <hr class="fleft" style="border: 1px solid #D9E1E3; width: 195px;" /> 
         <div class="CardItemDesc"> 
          <table width="100%" style="display: inline-block;"> 
           <tr> 
            <td> 
             <%# Eval("PRODUCT_NAME")%> 
            </td> 
           </tr> 
           <tr> 
            <td> 
             <telerik:RadRating ID="RadRating1" Skin="Metro" runat="server" Enabled="false" Value='<%# Double.Parse(Eval("SALES_PRICE").ToString()) % 3 +2 %>'> 
             </telerik:RadRating> 
            </td> 
           </tr> 
           <tr> 
            <td> 
             <img src="../images/Orders/AddToCart.png" alt="Add to Cart" height="23" onclick="AddToCart(this, '<%# Eval("PRODUCT_NAME")%>', '<%# Eval("SALES_PRICE") %>', '<%# Eval("CURRENCY_ABREVIATION") %>', '<%# (Eval("UNIT_SYMBOL").ToString()=="K" ? "Kg" : (Eval("UNIT_SYMBOL").ToString() == "U" ? "Pc" : Eval("UNIT_SYMBOL"))) %>', '<%# Eval("PRODUCT_ID") %>', '<%# Telepaty.SecurityHelper.StringEncryptorDecryptor.Instance.EncryptString(Eval("PRODUCT_ID").ToString()) %>');return false;" 
              class="Clickable fleft" /> 
             <% if (LoggedClient.Current != null) 
              { %> 
             <img src="../images/Orders/BuyNow.png" alt="Buy Now" style="padding-left: 30px;" 
              height="23" onclick="javascript:window.location='Checkout.aspx?pID=<%# Telepaty.SecurityHelper.StringEncryptorDecryptor.Instance.EncryptString(Eval("PRODUCT_ID").ToString()) %>';return false;" 
              class="Clickable fright" /> 
             <% } 
              else 
              { %> 
             <img src="../images/Orders/BuyNow.png" alt="Buy Now" style="padding-left: 30px;" 
              height="23" onclick="javascript:window.location='/Login.aspx?ref=anonym&pID=<%# Telepaty.SecurityHelper.StringEncryptorDecryptor.Instance.EncryptString(Eval("PRODUCT_ID").ToString()) %>';return false;" 
              class="Clickable fright" /> 
             <% }; %> 
            </td> 
           </tr> 
          </table> 
         </div> 
        </div> 
       </div> 
      </ItemTemplate> 
     </telerik:RadListView> 

lato server:

protected void Page_Load(object sender, EventArgs e) 
{ 
     if (!IsPostBack) 
    { 
     RadListView1.DataSource = OrderDataHelper.GetProductByCategoryforGrouping(); 
     RadListView1.DataBind(); 
    } 
} 

Il controllo RadListView non dispone di un segnaposto elemento specificato qualcuno sa perché questo problema si è verificato ?

+0

expalin ur scenario? –

+0

Ho trovato la risposta di @ zey per essere utile. – paqogomez

risposta

3

Imposta ItemPlaceholderID="ProductsHolder" nel tuo ListView ma non c'è PlaceHolder con un dato ID nel tuo LayoutTemplate.

Basta aggiungere il codice al tuo LayoutTemplate

<LayoutTemplate> 
     <asp:PlaceHolder ID="ProductsHolder" runat="server"></asp:PlaceHolder> 
    </LayoutTemplate> 
0

L'errore che si stanno ottenendo non significa che si dovrebbe dichiarare un controllo nella vostra LayoutTemplate che per determinare dove gli elementi (ItemTemplate, EditItemTemplate ecc) devono essere istanziati.

Si prega di fare riferimento a questo live demo per un esempio di come costruire RadListView a livello di programmazione.