简体   繁体   中英

client template in telerik grid in mvc

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).Title("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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM