ListItem description empty
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;
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.
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