1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Cannot Add Content Selector to Custom News View Admin Template

Cannot Add Content Selector to Custom News View Admin Template

3 posts, 0 answered
  1. LBrinley
    LBrinley avatar
    59 posts
    Registered:
    29 Dec 2005
    09 Aug 2009
    Link to this post
    I've mapped custom Admin templates for NewsItemEdit.ascx and NewsItemNew.ascx for a custom news provider.  To these templates I want to add a custom metafield called 'Overlay' of type Guid that is populated via a ContentSelector WebEditor.  The code I'm using for this Overlay metafield within the admin templates follows:
    <li class="selector">  
     
    <asp:Label ID="Label11" AssociatedControlID="Overlay" runat="server">  
     
    <asp:Literal ID="Literal7" runat="server" Text="<%$Resources:Overlay%>"></asp:Literal> 
     
    <em id="Em4" runat="server"></em></asp:Label> 
     
    <asp:TextBox ID="Overlay" Text="" runat="server" MaxLength="250"></asp:TextBox> 
     
    <asp:LinkButton ID="LinkButton3" runat="server" OnClientClick="javascript:needToConfirm=false;callAjaxFunc=false;" 
     
    Text="<%$Resources:Select%>" CssClass="picker" CausesValidation="false" CommandName="Pick" 
     
    CommandArgument="Overlay:Telerik.Cms.Engine.WebControls.ContentSelector, Telerik.Cms.Engine"></asp:LinkButton> 
     
    <class="example"><asp:Literal ID="Literal9" runat="server" Text="<%$Resources:OverlayNote%>"></asp:Literal></p>  
     
    </li> 
    The field and 'Select' button are created in the Admin interface.  However, I always get an 'Specified cast is not valid.' error whenever I click the 'Select' button for this field.  All my other WebEditors in these templates work fine.

    The Stack Trace follows:
    [InvalidCastException: Specified cast is not valid.]  
       Telerik.Cms.Web.UI.WebUITypeEditor`1.Telerik.Cms.Web.UI.IWebUITypeEditor.set_Value(Object value) +28  
       Telerik.Cms.Web.UI.PropertyEditorDialog.CreateChildControls() +689  
       System.Web.UI.Control.EnsureChildControls() +87  
       System.Web.UI.Control.PreRenderRecursiveInternal() +44  
       System.Web.UI.Control.PreRenderRecursiveInternal() +171  
       System.Web.UI.Control.PreRenderRecursiveInternal() +171  
       System.Web.UI.Control.PreRenderRecursiveInternal() +171  
       System.Web.UI.Control.PreRenderRecursiveInternal() +171  
       System.Web.UI.Control.PreRenderRecursiveInternal() +171  
       System.Web.UI.Control.PreRenderRecursiveInternal() +171  
       System.Web.UI.Control.PreRenderRecursiveInternal() +171  
       System.Web.UI.Control.PreRenderRecursiveInternal() +171  
       System.Web.UI.Control.PreRenderRecursiveInternal() +171  
       System.Web.UI.Control.PreRenderRecursiveInternal() +171  
       System.Web.UI.Control.PreRenderRecursiveInternal() +171  
       System.Web.UI.Control.PreRenderRecursiveInternal() +171  
       System.Web.UI.Control.PreRenderRecursiveInternal() +171  
       System.Web.UI.Control.PreRenderRecursiveInternal() +171  
       System.Web.UI.Control.PreRenderRecursiveInternal() +171  
       System.Web.UI.Control.PreRenderRecursiveInternal() +171  
       System.Web.UI.Control.PreRenderRecursiveInternal() +171  
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842  
     
    Why doesn't this WebEditor work like the others?  What am I missing?

  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    13 Aug 2009
    Link to this post
    Hello,

    Can you please try to do the same with metafield having type ShortText or LongText?

    Regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  3. LBrinley
    LBrinley avatar
    59 posts
    Registered:
    29 Dec 2005
    13 Aug 2009
    Link to this post
    Georgi,

    I did try using ShortText instead of Guid, but the 'invalid cast' error and stack trace were the same.  Since I could make no sense of the error (what cast, exactly, is failing?), I implemented my own custom RadWindow solution to allow selection and population of the Overlay field as a ShortText.  This provided the opportunity to discover bidirectional RadWindow communication and the RadGrid client-side API.  Works well.

    Thanks for responding.
Register for webinar
3 posts, 0 answered