问题描述
我在我的页面中使用了 Telerik 网格。在这个网格中,我们检索每个仪式来宾的列表。我们还有一栏来评价每位客人。 rating 列的值是从模型(数据库)中检索的。例如,假设 GUEST1 的 rating 列的值为 3。在这种情况下,我的期望是在网格中看到 3 个实心星。但它不起作用!!! 有谁能帮帮我吗???
@(Html.Kendo().Grid(Model.Guests)
.Name("grid")
.Columns(columns =>
{
columns.Bound(c => c.GuestId).Width(40).Title("کد");
columns.Bound(c => c.Guest).Width(140).Title("میهمان").EditorTemplateName("GuestEditor").ClientTemplate(
@"<div class='product-photo'
style='background-image: url(" + @Url.Content("~/#:GuestPic#") + ");'></div><div class='product-name'>#:Guest#</div>").Width(300);
//.EditorTemplateName("Country").ClientTemplate(
//@"<div class='k-text-center'><img class='product-photo' src='" + @Url.Content("~/#:GuestPic#") + "' alt='#: Guest#' title='#: Guest#' width='100' /></div>").Width(220);
columns.Bound(c => c.GuestType).Title("نوع میهمان").Width(190);
columns.Bound(c => c.Satisfication).Title("رضایتمندی").Width(150).Editable("returnFalse")
.ClientTemplate(Html.Kendo().rating()
.Name("rating_#=GuestId#")
.Min(1)
.Max(5)
.Label(false)
//.Value(Model.Satisfication);
.HtmlAttributes(new { data_bind = "value: Satisfication" })
//.Selection("continuous");
.ToClientTemplate().Value);
})
.Events(ev => ev.DataBound("onDataBound"))
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("ceremonyGuest","Grid"))
))
<script type="text/javascript">
function returnFalse() {
return false;
}
function onDataBound(e) {
var grid = this;
grid.table.find("tr").each(function () {
var dataItem = grid.dataItem(this);
//var themeColor = dataItem.discontinued ? 'success' : 'error';
//var text = dataItem.discontinued ? 'available' : 'not available';
$(this).find('script').each(function () {
eval($(this).html());
});
$(this).find(".badgeTemplate").kendobadge({
themeColor: themeColor,text: text,});
kendo.bind($(this),dataItem);
});
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)