Controller:
public class RotatorController : SitecoreController
{
public ActionResult Index()
{
var dataSourceId = RenderingContext.CurrentOrNull.Rendering.DataSource;
var dataSource = Sitecore.Context.Database.GetItem(dataSourceId);
var viewModel = new RotatorViewModel
{
RotatorItems = dataSource.Children
};
return View(viewModel);
}
}
View Model:
public class RotatorViewModel
{
public IEnumerable<Item> RotatorItems { get; set; }
}
View:
@model RotatorViewModel
<h1>Products List</h1>
@foreach (var item in Model.RotatorItems)
{
<h2>@item.Fields["Title"]</h2>
@item.Fields["Image"]
@item.Fields["Description"]
}
my doubt is:
the description(discription is a field) is of type table....but in webpage it is renderd as tags
and also for the image
can anyone help me with this?