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

Forums / Developing with Sitefinity / Create a custom list (Guestbook)

Create a custom list (Guestbook)

2 posts, 0 answered
  1. Magnus
    Magnus avatar
    28 posts
    Registered:
    26 May 2009
    10 Sep 2009
    Link to this post
    Hi there.

    I've been searching for some hours now about how to create some own custom-made lists. But i really dont find any good information.

    My goal: Create a simple "Guestbook" by using the List Module within Sitefinity. Listing the posts inside a List "Guestbook". So the admin simply can edit/remove the posts if he/she finds some posts which shouldn't be there.

    I want one control to list all the posts and at the top a simple RadEditor control with a "Post comment" button.

    And a control which i'm able to list the latest 3 posts from the "Guestbook" list.



    My problems:

    1. First of all, i was hoping to be able to create own "fields" in a list. But that idea i gave up kinda quick, when i understood that it's impossible.

    2. Instead a used the Content field for all the post-information. (which isnt so good, due the fact that you really cant sort the list by name, date etc).

    My content will now look something like this:

    Date:   6 augusti 2009, 13:07:04
    Namn:   Sandra Svahn
    "Hi there, this is a guestbook post"

    3. I can list the items in the List Guestbook, but i cant Sort or Order them at the moment. Is that possible? I need to order them by some form of ID in a DESC way (so i can get the last 3 posts that was posted).




    So. How do you make a simple guestbook control which can be included inside the CMS-section? Am i all out in the blue when i considering this way of approch?


    Thanks for all help/ideas i can get.   / Magnus



  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    20 Sep 2016
    14 Sep 2009
    Link to this post
    Hi Magnus,

    Thank you for posting your inquiry.
    Let me an answer to your questions one by one:

    1. First of all, i was hoping to be able to create own "fields" in a list. But that idea i gave up kinda quick, when i understood that it's impossible. 
    You are right. This is only supported for Generic Content based modules. The approach with the existing content property should work fine though. 

    2. Instead a used the Content field for all the post-information. (which isnt so good, due the fact that you really cant sort the list by name, date etc).
    What you can do in this case is to override the default Lists control, and the method which creates the datasource. Then you can perform custom filtering on the list of items - read every one of them, parse it to extract the information on which you can sort, and perform the sorting. Check the reply on the next question as well. 

    3. I can list the items in the List Guestbook, but i cant Sort or Order them at the moment. Is that possible? I need to order them by some form of ID in a DESC way (so i can get the last 3 posts that was posted).

    Please check the following article - Finding List Items. The List manager class supports methods for taking list items sorted, and with limiting - for example the last three items. 

    The other thing you could do is to use Generic Content, and store the guestbook entries through a custom provider. This provider should be defined in the web.config file.

    Best wishes,
    Georgi
    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.
2 posts, 0 answered