I want to add an image to a data grid column, I am using telerik grid for this, however I get the following error, its on Line 51:
Compiler Error Message: CS1525: Invalid expression term ')'
Source Error:
Line 49: column.Bound(o => o.HoursWorked).Title("Hours");
Line 50: column.Template(o =>
Line 51: {%>
Line 52: <img src="/Content/img/delete.png" alt="Delete" title="Delete"/>
Line 53: <%
Here is how I am trying to add an image to the column:
<div>
<%=Html.CustomGridFor("Hours", "WorkHours", "HoursWorked", GridOptions.EnableSelecting, Model).Columns(column =>
{
column.Bound(o => o.DateWorked).Title("Date").Width("65px");
column.Bound(o => o.Description).Title("Description").Width("120px");
column.Bound(o => o.HoursWorked).Title("Hours");
column.Template(o =>
{%>
<img src="/Content/img/delete.png" alt="Delete" title="Delete" onclick="javascript:deleteHours();" />
<%
}).Title("").ClientTemplate(
"<img src=\"/Content/img/delete.png\" alt=\"Delete\" title=\"Delete\"/>"
).Width(15);
}).HtmlAttributes(new { style = "width: 270px;" });
%>
</div>
Tried this too:
<div>
<%=Html.CustomGridFor("Hours", "WorkHours", "HoursWorked", GridOptions.EnableSelecting, Model).Columns(column =>
{
column.Bound(o => o.DateWorked).Title("Date").Width("65px");
column.Bound(o => o.Description).Title("Description").Width("120px");
column.Bound(o => o.HoursWorked).Title("Hours");
column.Template(o =>
{
%>
<img
alt="Delete"
src="/Content/img/delete.png"
/>
<%
});
</div>