带复选框的Telerik网格-网格最初绘制时未显示复选框 [英] Telerik grid with checkbox - Checkbox not showing up when the grid initially paints

查看:98
本文介绍了带复选框的Telerik网格-网格最初绘制时未显示复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带复选框的telerik网格.我正在使用客户端模板.有一个附加的.DataBinding Ajax调用.

I have a telerik grid with a checkbox. I am using a client template. There is a .DataBinding Ajax call attached.

最初显示网格时,它的id值为文本,而不是复选框.如果我单击刷新,则执行ajax调用,当它回来时,将出现该复选框.有什么办法可以强制在网格最初绘制时进行ajax调用,以便我有一个复选框而不是文本...

When the grid initially comes up, instead of a checkbox, it has the id value as text. If I hit refresh, the ajax call gets executed and when it comes back the checkbox appears. Is there any way to force the ajax call to happen when the grid initially paints so that I have a checkbox and not text ...

代码示例:

<% Html.Telerik().Grid(Model.AdminSongQueue)
    .Name("Grid")
    .Columns(columns =>
        {
            columns.Bound(o => o.UserTrackAssignmentID)
               .ClientTemplate("<input type='checkbox' name='checkedRecords' value='<#= UserTrackAssignmentID #>' />")
               .Title("Check")
               .Width(50)
               .HtmlAttributes(new {style="text-align:center"});           
        })
    .DataBinding(dataBinding => dataBinding.Ajax()
            .Select("_CheckBoxesSongGrid", "RightsToolSvc"))
    .Scrollable()
    .Pageable()
    .Render();
%>

推荐答案

在我的视图(viewname.cshtml,MVC)中,我在.ClientTemplate之前添加了以下内容:

In my View (viewname.cshtml, MVC) I added the following before my .ClientTemplate:

     .Template(
 @<text> <input type='checkbox' id='chkMessage' name='checkedMovies' value='<#= ID #>' /> </text>)

...

与此帖子相关,我找到了答案这里

This post is related, I found my answer here

这篇关于带复选框的Telerik网格-网格最初绘制时未显示复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆