Reputation: 37
i have a mvc grid where i want to bind images which are saved as url in database.I am new to mvc grid.please help me out.Thanks..
This is the code:
@using GridMvc.Html
@Html.Grid(Model).Named("SalesDueOrderListPartial").Columns(columns =>
{
columns.Add(c => c.OrderNo).Titled("Order No").Filterable(true);
columns.Add(c => c.ImageUrl).Titled("Image").Filterable(false);
}).WithPaging(@ViewBag.paging).Sortable(true)
Upvotes: 0
Views: 2559
Reputation: 1774
Try this
columns.Add().Encoded(false).Sanitized(false).Titled("Image").Filterable(false).RenderValueAs(c => @<div style="width:100px;"><img alt="Image" src='@c.ImageUrl')" /></div>);
Upvotes: 2