ListItem description empty

Posted by Community Admin on 04-Aug-2018 15:05

ListItem description empty

All Replies

Posted by Community Admin on 20-Sep-2011 00:00

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

Posted by Community Admin on 20-Sep-2011 00:00

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

Posted by Community Admin on 20-Sep-2011 00:00

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

This thread is closed