<%{
WebGrid studentGrid = new WebGrid(rowsPerPage: StudentController.PageSize);
studentGrid.Bind(Model.Students, autoSortAndPage: false, rowCount: Model.RowCount);
studentGrid.PageIndex = Model.CurrentPage;
}%>
<%=studentGrid.GetHtml(columns: new WebGridColumn[]{
studentGrid.Column("StudentId", "Id"),
studentGrid.Column("Name", "Name"),
})%>
Unfortunatly i am forced to use aspx view in my MVC3 project.
I want to have a column that shows a text "select" or "remove" based on some condition of the list item that is bound to the grid.
How is the sysntax to do that
I have to get render html like
<span class="1" id=item.id>Select<span>
and the html shown will be just Select
Anonymous User
20-Nov-2014You can definitely do it with format you just need to handcraft the HTML in C#:
Using the aspx template systax (eg. <% %>) inside a lambda is supported in general (see this Telerik demo) but because the WebGrid working diffidently than Telrik it's not working.
It seems the way is WebGrid built only supports razor templates inside the format argument