开发者

client template in telerik grid in mvc

开发者 https://www.devze.com 2023-03-24 03:57 出处:网络
i have bind the client template in my telerik grid but it does not appears in my column why does it happens does i have to call it

i have bind the client template in my telerik grid but it does not appears in my column why does it happens does i have to call it

view

<%=Html.Telerik().Grid(Model).Name("Grid").DataKeys(keys => keys.Add(m => m.ResExpID))
  .Columns(columns =>
{
    columns.Bound(m => m.ResExpID).Width(100);
    columns.Bound(m => m.Company).Width(100);

    columns.Bound(m => m.Title).Width(200);
    columns.Bound(m=>m.Description).ClientTemplate(                             
                                Html.Telerik().DropDownList()
                                .Name("UserState<#= UserState #>")
                                .BindTo(new SelectList(us.GetUserNameByEmail("ghg").ToList()))
                                .Encode(false)
                                .ToHtmlString().Replace("{", "{{").Replace("}", "}}")).Encoded(false)

    .Title("User State");

; columns.Command(commands => {

            commands.Edit().ButtonType(GridButtonType.Text);
            commands.Delete().ButtonType(GridButtonType.Text);

        }).Width(200).T开发者_Go百科itle("Command");









})
 .ClientEvents(events => events.OnRowSelect("onRowSelected"))











    .DataBinding(dataBinding =>
    {


        dataBinding.Server()
          .Select("WorkExperience", "Editresume")

          .Update("_Saveexperience", "Editresume")


        .Delete("_Deleteexperience", "Editresume");

    })
    .Scrollable(scrolling => scrolling.Enabled((bool)ViewData["scrolling"]))
    .Sortable(sorting => sorting.Enabled((bool)ViewData["sorting"]))
    .Pageable(paging => paging.Enabled((bool)ViewData["paging"]))
    .Filterable(filtering => filtering.Enabled((bool)ViewData["filtering"]))
    .Groupable(grouping => grouping.Enabled((bool)ViewData["grouping"]))
    .Footer((bool)ViewData["showFooter"])
    .Editable(editing => editing.Mode(GridEditMode.PopUp))


    .RowAction(row => row.Selected = row.DataItem.ResExpID.Equals(ViewData["id"]))

    %>  


I had a similar issue. You can check this page that will probably help you:

http://www.telerik.com/community/forums/aspnet-mvc/grid/client-template-not-displayed-with-mvc-grid.aspx

What it says is the binding occurs on the server when you provide the model like you do:

.Grid(Model).

and the client templates are applied when the binding occurs on the client. The simplest solution would be to use this overload of the ' Grid ' constructor:

.Grid<Namespace.Module.Your.Type>().

then the client template should appear.

0

精彩评论

暂无评论...
验证码 换一张
取 消