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

Forums / Developing with Sitefinity / Generic Content With Expend list

Generic Content With Expend list

6 posts, 0 answered
  1. Cyril Wasem
    Cyril Wasem avatar
    20 posts
    Registered:
    04 Aug 2009
    06 Oct 2009
    Link to this post
    Hi.
    i try to create a GenericContent with expand capacitie like :
    acsx
    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="GenericContentExpand.ascx.cs" Inherits="Sitefinity_UserControls_GenericContentExpand" %> 

    <

     

    telerik:jsfilelink id="jsfilelink1" embeddedfilename="telerik.lists.resources.expandablelist.js" filename="" runat="server" />

     

    <%@ Register Assembly="Telerik.Cms.Engine" Namespace="Telerik.Cms.Engine.WebControls"  TagPrefix="sfWeb" %>    
    <dl>    
       <dd> 
       <h2 id="<%=this.ID.ToString()%>Title"><a href="javascript:toggleDisplay('<%=this.ID.ToString()%>','<%=this.ID.ToString()%>Title')" id="<%=this.ID.ToString()%>A" shape="rect">  
    <%=this.Titre.ToString()%></a></h2>    
       </dd>    
       <dd> 
        <div id="<%=this.ID.ToString()%>">  
           <sfWeb:GenericContent runat="server" ID="GenericContent1" />        
       </div>    
       </dd>    
    </dl> 
    cs
    using System;  
    using System.Collections;  
    using System.ComponentModel;  
    using System.Configuration;  
    using System.Data;  
    using System.Linq;  
    using System.Web;  
    using System.Web.Security;  
    using System.Web.UI;  
    using System.Web.UI.HtmlControls;  
    using System.Web.UI.WebControls;  
    using System.Web.UI.WebControls.WebParts;  
    using System.Xml.Linq;  
    using Telerik.Cms.Engine;  
    using Telerik.Cms.Engine.WebControls;  
    using Telerik.Framework.Web.Design;  
    using Telerik.Web;  
     
    [ControlDesignerAttribute("Telerik.Cms.Engine.WebControls.Design.GenericContentDesigner, Telerik.Cms.Engine")]  
    public partial class Sitefinity_UserControls_GenericContentExpand : System.Web.UI.UserControl, IGenericContent   
    {  
        private string _titre = "";  
        [Category("Titre")]  
        public string Titre  
        {  
            get { return _titre; }  
            set { _titre = value; }  
        }  
     
        private string _id = Convert.ToString( Guid.NewGuid());  
        [Category("ID")]  
        public string ID  
        {  
            get { return _id; }  
            set { _id = value; }  
        }  
     
        protected void Page_Load(object sender, EventArgs e)  
        {  
     
        }  
     
        #region IGenericContent Members    
       [CmsBrowsable(false)]    
       [CmsPersistable(true)]    
       public string Content    
       {    
           get    
           {    
               return GenericContent1.Content;    
           }    
           set    
           {    
               GenericContent1.Content = value;    
           }    
       }    
       [Browsable(false)]    
       public Guid ContentID    
       {    
           get    
           {    
               return GenericContent1.ContentID;    
           }    
           set    
           {    
               GenericContent1.ContentID = value;    
           }    
       }    
       public string ProviderName    
       {    
           get    
           {    
               return GenericContent1.ProviderName;    
           }    
           set    
           {    
               GenericContent1.ProviderName = value;    
           }    
       }    
       [Browsable(false)]    
       public IContent SharedContent    
       {    
           get    
           {    
               return this.GenericContent1.SharedContent;    
           }    
       }    
       public bool UseStagedVersion    
       {    
           get    
           {    
               return GenericContent1.UseStagedVersion;    
           }    
           set    
           {    
               GenericContent1.UseStagedVersion = value;    
           }    
       }    
       [CmsBrowsable(false), CmsPersistable(true)]    
       public bool HasDynamicLinks    
       {    
           get    
           {    
               return GenericContent1.HasDynamicLinks;    
           }    
           set    
           {    
               GenericContent1.HasDynamicLinks = value;    
           }    
       }    
       public string GetItemUrl(string provider, Guid id, bool resolveAsAbsoluteUrl)    
       {    
           return GenericContent1.GetItemUrl(provider, id, resolveAsAbsoluteUrl);    
       }    
       public void RenderBinaryContent(HtmlTextWriter writer)    
       {    
           GenericContent1.RenderBinaryContent(writer);    
       }    
       public void RenderTextContent(HtmlTextWriter writer)    
       {    
           GenericContent1.RenderTextContent(writer);    
       }    
       #endregion    
    }    
     
     
     
    My question is :
    Can i use

    <

     

    telerik:jsfilelink id="jsfilelink1" embeddedfilename="telerik.lists.resources.expandablelist.js" filename="" runat="server" />

     

     like the ExpandableListView.ascx but i have a javascritp error.

    have you a solution ?

    Thk's
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    06 Oct 2009
    Link to this post
    Hello Cyril Wasem,

    The embedded resources can be used only in the assemble. To show your dialog you need to use your js code. A good option is using JQuery.

    Example:

    <sf:JsFileLink ID="jQuery" runat="server" FileName="~/Scripts/jquery.js" />  
     
    ..... 
       ..... 
     
     
     
     
    <script type="text/javascript">   
      
    $(document).ready(function(){   
       $(".sf_gcTitle").click(function(event){   
         event.preventDefault();   
         $(this).next().toggle("slow");   
        });   
     });   
      
    </script>   

    You can wrap all public controls inside a div. I hope this helps.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Mart
    Mart avatar
    66 posts
    Registered:
    10 Aug 2006
    29 Oct 2009
    Link to this post
    Hello all,

    I try to use this script on my listmaster.ascx in but editmode a popup shows telling me that there is a runtime error
    property or method not supported by this object.
    In live site there is no problem

    please help,

    Mart
  4. Mart
    Mart avatar
    66 posts
    Registered:
    10 Aug 2006
    30 Oct 2009
    Link to this post
    Hello,

    do you at Telerik have any suggestions to this problem?

    Yours,

    Mart
  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    04 Nov 2009
    Link to this post
    Hello Mart,

    The function is looking for a class with name .sf_gcTitle. When you click we call toggle method with slow parameter.  You can learn more about JQuery at http://jquery.com/ I suggest that you should ContentView control instead of Generic Content. Also you cannot get the Generic Content working in the way you have wrapped it in a user control. You should create a custom control that inherits from Generic Content/

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. Mart
    Mart avatar
    66 posts
    Registered:
    10 Aug 2006
    04 Nov 2009
    Link to this post
    Thanks Ivan.

Register for webinar
6 posts, 0 answered