More in this section

Forums / Developing with Sitefinity / Custom Field for a Lists Module

Custom Field for a Lists Module

4 posts, 0 answered
  1. Dmitri Khait
    Dmitri Khait avatar
    6 posts
    Registered:
    15 Jul 2005
    09 Jul 2010
    Link to this post
    Is it possible to add a Custom Field to a Lists Module. I tried this syntax but it does not work

    <add key="Lists.Description" valueType="ShortText" visible="True" searchable="False" sortable="True" defaultValue=""/>

    The strange thing is that when I add the above line to web.config then the "blogs" module disappears from a menu

    I use version 3.7 sp3

    thank you!
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    09 Jul 2010
    Link to this post
    Hello Dmitri Khait,

    Lists module is not a Generic Content based module and it does not support dynamic metafields. You need to create a custom persistent class for additional fields.

    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
  3. Dmitri Khait
    Dmitri Khait avatar
    6 posts
    Registered:
    15 Jul 2005
    09 Jul 2010
    Link to this post
    thank you!

    I need to create a small ui navigation control on my site. An admin person should be able to add/remove and rank links. The site's user will see links in a form of unordered list. Preferrably an admin person should be able to select pages on the site with a build in web editor. What's the best way to go about it? Custom module?

    thanks again.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    09 Jul 2010
    Link to this post
    Hello Dmitri Khait,

    1. Create a user control.

    2. Expose public properties to enter page names. Implement WebUTypeEditor that will give you a list of all pages and return the the page name value to a property

    3. You could also try using SiteMenu builder

    Below is a sample of a user control that generates ul with a tags

    protected override void OnPreRender(EventArgs e)
       {
           base.OnPreRender(e);
      
           HtmlGenericControl ulCntrl = new HtmlGenericControl("ul");
           HtmlGenericControl pControl = new HtmlGenericControl("b");
           var pLiteral = new Literal();
           pLiteral.Text = "Categories";
           pControl.Controls.Add(pLiteral);
           ulCntrl.Controls.Add(pControl);
           Controls.Add(ulCntrl);
            
           foreach (string s in list1)
           {
               HtmlGenericControl liCntrl = new HtmlGenericControl("li");
               HtmlGenericControl hrefControl = new HtmlGenericControl("a");
               hrefControl.Attributes.Add("href", s + ".aspx");
               var literalControl = new Literal();
               literalControl.Text = s;
               hrefControl.Controls.Add(literalControl);
               liCntrl.Controls.Add(hrefControl);
               ulCntrl.Controls.Add(liCntrl);
           }
      
       }
      
       public string PagesList1
       {
           get
           {
               StringBuilder linkBuilder = new StringBuilder();
               if (list1 != null)
               {
                   foreach (string str in list1)
                   {
                       linkBuilder.Append(str);
                       linkBuilder.Append(", ");
                   }
               }
               if (linkBuilder.Length >= 2)
               {
                   linkBuilder.Remove(linkBuilder.Length - 2, 2);
               }
               return linkBuilder.ToString();
           }
           set
           {
               string[] pages = value.Split(',');
               list1 = new List<string>();
               foreach (string p in pages)
               {
                   if (!String.IsNullOrEmpty(p.Trim()))
                       list1.Add(p.Trim());
               }
           }
       }
      
      
       private List<string> list1;


    Sincerely yours,
    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