More in this section

Forums / Developing with Sitefinity / Library Item Selection Error

Library Item Selection Error

4 posts, 0 answered
  1. KMac
    KMac avatar
    133 posts
    Registered:
    15 Dec 2008
    14 Apr 2010
    Link to this post
    Hello,

    I'm currently using the latest build of Sitefinity (3.7.2096) and am trying to associate a button selector with a textbox inside a RadGridTemplate column like so:

    <EditItemTemplate>
                           <asp:TextBox ID="CVLocationTextBox" runat="server" 
                               Text='<%# Bind("CVLocation") %>'></asp:TextBox>
                               <sfLib:ButtonSelector ID="ButtonSelector2" runat="server" ButtonText="Select from Libraries or FilesSystem" WindowNavigateUrl="~/Sitefinity/UserControls/Dialogs/ImageDialog.aspx" AssociatedControls="CVLocationTextBox" />   
                       </EditItemTemplate>

    This works for me in 3.7.2057 without issue. It allows me to open the imageDialog.aspx and choose an item from a library. Now that I've upgraded it doesn't work any more. I can open up the initial screen for the ImageDialog.aspx but when I try to click on a library I get the following:

    DataBinding: 'Telerik.Cms.Engine.Data.CmsContentBase' does not contain a property with the name 'Name'. 
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
      
    Exception Details: System.Web.HttpException: DataBinding: 'Telerik.Cms.Engine.Data.CmsContentBase' does not contain a property with the name 'Name'.
      
    Source Error: 
      
      
    Line 1:  <asp:PlaceHolder ID="imagePlaceHolder" runat="server" Visible="false">
    Line 2:      <p class="availableImagesPreview"><asp:Image runat="server" ID="thumbnail" ImageUrl='<%#Eval("ThumbnailUrl").ToString() + "?width=80&height=80&decreaseOnly=true" %>'/></p>
    Line 3:      <strong><asp:Literal ID="Label1" runat="server" Text='<%# Eval("Name") %>'></asp:Literal></strong>
    Line 4:  </asp:PlaceHolder>
    Line 5:  <asp:PlaceHolder ID="documentPlaceHolder" runat="server">    
       
      
    Source File: C:\inetpub\wwwroot\PPD_New\Sitefinity\Admin\ControlTemplates\Libraries\SelectorItemView.ascx    Line: 3 
      
    Stack Trace: 
      
      
    [HttpException (0x80004005): DataBinding: 'Telerik.Cms.Engine.Data.CmsContentBase' does not contain a property with the name 'Name'.]
       System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName) +8683885
       System.Web.UI.DataBinder.Eval(Object container, String[] expressionParts) +92
       System.Web.UI.DataBinder.Eval(Object container, String expression) +93
       System.Web.UI.TemplateControl.Eval(String expression) +43
       ASP.sitefinity_admin_controltemplates_libraries_selectoritemview_ascx.__DataBindingLabel1(Object sender, EventArgs e) in C:\inetpub\wwwroot\PPD_New\Sitefinity\Admin\ControlTemplates\Libraries\SelectorItemView.ascx:3
       System.Web.UI.Control.OnDataBinding(EventArgs e) +91
       System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +92
       System.Web.UI.Control.DataBind() +15
       System.Web.UI.Control.DataBindChildren() +201
       System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +101
       System.Web.UI.Control.DataBind() +15
       System.Web.UI.Control.DataBindChildren() +201
       System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +101
       System.Web.UI.Control.DataBind() +15
       System.Web.UI.Control.DataBindChildren() +201
       System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +101
       System.Web.UI.Control.DataBind() +15
       System.Web.UI.Control.DataBindChildren() +201
       System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +101
       System.Web.UI.Control.DataBind() +15
       Telerik.Libraries.WebControls.ItemView.CreateChildControls() +2372
       System.Web.UI.Control.EnsureChildControls() +102
       System.Web.UI.Control.PreRenderRecursiveInternal() +42
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496
      
      

    Has something changed that would cause this?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    14 Apr 2010
    Link to this post
    Hi KMac,

    I created a sample control and wrapped the ButtonSelector in the EditItemTemplate of a RadGrid column

    <telerik:RadGrid runat="server" ID="RadGrid1" AutoGenerateColumns="false" Skin="Vista">
     <MasterTableView CommandItemDisplay="TopAndBottom" AutoGenerateColumns="False" DataKeyNames="number" AllowAutomaticInserts="false"  TableLayout="Auto">
        <EditFormSettings InsertCaption="Add new item" CaptionFormatString="Edit Item: {0}" CaptionDataField="number" PopUpSettings-Modal="true" />
        <Columns>
         <telerik:GridBoundColumn HeaderText="username" DataField="username" UniqueName="Name"></telerik:GridBoundColumn>
         <telerik:GridBoundColumn HeaderText="number" DataField="number" UniqueName="number"></telerik:GridBoundColumn>
         <telerik:GridEditCommandColumn HeaderText="Edit" UniqueName="EditCommandColumn">
         </telerik:GridEditCommandColumn>
         <telerik:GridButtonColumn CommandName="Delete" Text="Delete" HeaderText="Delete" ></telerik:GridButtonColumn>
          
         <telerik:GridTemplateColumn  HeaderText="testButton" SortExpression="testButton" UniqueName="testButton"
                            EditFormColumnIndex="1">
                            <ItemTemplate>
                                <asp:Label runat="server" ID="lbl1" Text="label"></asp:Label>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox ID="CVLocationTextBox"  runat="server"
                               Text="dsada"></asp:TextBox>
                               <sfLib:ButtonSelector ID="ButtonSelector2" runat="server" ButtonText="Select from Libraries or FilesSystem" WindowNavigateUrl="~/Sitefinity/UserControls/Dialogs/ImageDialog.aspx" AssociatedControls="CVLocationTextBox" />
                            </EditItemTemplate>
        </telerik:GridTemplateColumn>
        </Columns>
         <EditFormSettings ColumnNumber="2" CaptionDataField="number" CaptionFormatString="Edit properties of item {0}">
                       <FormTableItemStyle Wrap="False"></FormTableItemStyle>
                        <FormCaptionStyle CssClass="EditFormHeader"></FormCaptionStyle>
                        <FormMainTableStyle GridLines="None" CellSpacing="0" CellPadding="3" BackColor="White"
                            Width="100%" />
                        <FormTableStyle CellSpacing="0" CellPadding="2" Height="110px" BackColor="White" />
                        <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle>
                        <EditColumn ButtonType="ImageButton" InsertText="Insert Order" UpdateText="Update record"
                            UniqueName="EditCommandColumn1" CancelText="Cancel edit">
                        </EditColumn>
                        <FormTableButtonRowStyle HorizontalAlign="Right" CssClass="EditFormButtonRow"></FormTableButtonRowStyle>
                    </EditFormSettings>
       </MasterTableView>
    </telerik:RadGrid>

    I was not able to reproduce the issue you have. The template SelectorItemView.ascx    is loaded when you try to open a library and it have Eval property that is binds the "Name" metadata of an IContent item. Make sure that the files listed below are the same as those one from the patch

    • Sitefinity\Admin\ControlTemplates\Libraries\Dialogs\ItemSelector.ascx
    • Sitefinity\Admin\ControlTemplates\Libraries\SelectorItemView.ascx
    Check whether all images/documents items have "Name" metakey set.


    Regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. KMac
    KMac avatar
    133 posts
    Registered:
    15 Dec 2008
    15 Apr 2010
    Link to this post
    Hey Ivan,

    As always, thanks for the quick and thorough response. Turns out Visual Studio 2010 (and maybe me) were to blame. When opening up this project I let VS convert to ASP.net 4.0 and since everything seemed to work, I went with it. Apparently not such a good idea. When I switched back to 3.5 the error went away.

    Thanks again for your help.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    15 Apr 2010
    Link to this post
    Hello KMac,

    Thanks for getting back to me. Yes, Sitefinity 3.x does not support .NET Framework 4.0. The project could run fine, but there are some annoying problems that I also faced when rebuilded to .NET Framework 4.0

    Sitefinity version 4.0 will support .NET Framework 4.0 and 3.5.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Register for webinar
4 posts, 0 answered