Telerik's Grid in MVC3 razor and ClientTemplate colums
I'm starting a new project in MVC3 and whant to use Razor view engine. Right now I'm having problems working with ClientTemplate.
Right now all <# Property #> returns [object Object] , why?
Here's my code and it was working in MVC2 project not in Razor :
@(Html.Telerik().Grid<User>()
.Name("Grid")
.Columns(colums =>
{
colums.Bound(c => c.Email);
colums.Bound(c => c.Id).Title(" ").HtmlAttributes(new { @class = "center-text" })
.ClientTemplate("<a id=\"deleteLink\" href=\"#\" title=\"Delete\" onclick=\"if(confirm('" + Strings.ConfirmDeleteAdmin + "')){ return deleteItem('<#=Id#>');} else开发者_开发问答 { return false;};\"><img src=\"Content/images/icons/cross.png\" alt=\"" + Strings.Delete + "\" /></a>");
})
.DataBinding(d => d.Ajax().Select(MVC.Admin.ListAjax().GetRouteValueDictionary()))
.Sortable()
//.Pageable()
)
Thx
I found out that my Id property was not a string and that's the source of my problem. What I did is I'm returning a simpler object to my grid that is built from the real object so that my Id property is a string and it works perfectly.
精彩评论