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

Forums / Developing with Sitefinity / ListItem description empty

ListItem description empty

3 posts, 1 answered
  1. Daniel Plomp
    Daniel Plomp avatar
    952 posts
    Registered:
    18 Feb 2004
    20 Sep 2011
    Link to this post
    Hi all,

    I have a simple image slider that is based on the List module. Each ListItem contains a title, description and thumbnail.
    It works okay except for the description that seems empty.

    Here is the code I use on ItemDataBound of the repeater.

    void GalleryList_ItemDataBound(object sender, RepeaterItemEventArgs e) {
     
                if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) {
     
                    var item = e.Item.DataItem as Telerik.Sitefinity.Lists.Model.ListItem;
     
                    var imgGallery = e.Item.FindControl("imgGallery") as Image;
                    var imageId = new Guid(item.GetValue("Thumbnail").ToString());
                    if (imageId != Guid.Empty) {
                        imgGallery.ImageUrl = App.WorkWith().Image(imageId).Get().MediaUrl;
                    }
     
                    var litTitle = e.Item.FindControl("litTitle") as Literal;
                    litTitle.Text = item.Title;
     
                    var litDescription = e.Item.FindControl("litDescription") as Literal;
                    litDescription.Text = item.Description;
                     
                }
            }

    So 'item.Description' should be the description that I filled in with the ListItem, but it is null.
    Is this common or do I have to use another field/property?

    Regards,
    Daniel
  2. Svetoslav Petsov
    Svetoslav Petsov avatar
    456 posts
    Registered:
    24 Sep 2012
    20 Sep 2011
    Link to this post
    Hello Daniel,

    Are you sure you are getting the right property here? Is there a chance that you need the Content property instead of the Description property, as the Description property is by default not exposed as a field in the List Item's Edit form. If you need the content of the item (e.g. the field of type "Long text" under the "Title" field of the List Item, which is displayed as a Rad Editor), you can easily get it with item.Content. If you need to expose the Description field, this can be done by going to Custom Fields for List Items >> Description >> Appearance.
    If this is not the case and you have the Description property exposed and filled in the List Item, please get back to me with the .ascx template of your custom control.

    Best wishes,
    Svetoslav Petsov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
  3. Daniel Plomp
    Daniel Plomp avatar
    952 posts
    Registered:
    18 Feb 2004
    20 Sep 2011
    Link to this post
    You are right, if I use item.Content, it shows the content.
    I just was thinking that I could use 'Description', since it is named that way in the code and in the UI.

    But 'Description' is indeed not persisted.

    Works now. Thanks!

    Daniel
3 posts, 1 answered