当我编辑一行时 ,我有一个 Telerik 网格 : 但是如果我按下更新按钮甚至取消(观看中间列):
这是声明:
<%= Html.Telerik().Grid<AlefTech.HumanResource.WebModule.ViewDto.MaritialStatusItemEditDto>(Model)
.Name("Grid")
.DataKeys(keys => { keys.Add(c => c.MaritialStatusItemID); keys.Add(k => k.Index); })
.Columns(columns =>
{
//columns.Bound(m => m.MaritialStatusItemID).Visible(false);
columns.Bound(m => m.Index).Title("").Sortable(false).Width(0);
columns.Bound(m => m.Name);
//columns.Bound(m => m.Brithdate).Width(130).Format("{0:d}");
//columns.Bound(m => m.Gender);
columns.Bound(m => m.MaritialStatusItemType);
//columns.Bound(m => m.Notes);
//columns.Bound(m => m.Status);
//columns.Bound(m => m.CreationDate);
//columns.Bound(m => m.ItemGuid);//.ClientTemplate("<input type='hidden' value='<#ItemGuid#>' name='ItemGuid' id='WorkerID'>");
columns.Command(command => { command.Edit(); command.Delete(); });
})
//.ClientEvents(cfg => cfg.OnDataBound("onRowDataBound"))
.ToolBar(t => t.Insert())
.DataBinding(d => d.Ajax()
.Select("MartialStatusGridSelect", "Worker")
.Insert("MartialStatusGridInsert", "Worker")
.Update("MartialStatusGridUpdate", "Worker")
.Delete("MartialStatusGridDelete", "Worker"))
.Scrollable()
.Editable(editing => editing.Enabled(true))
.Sortable()
.HtmlAttributes(new { @class = "t-grid-rtl", @hegiht = "450px" })
.Pageable()
%>
和模型:
public class MaritialStatusItem : BaseEntity
{
[StringLength(50)]
[Required]
public virtual string Name { get; set; }
[UIHint("MaritialStatusEnum")]
public virtual MilitaryStatusEnum MaritialStatusItemType { get; set; }
}
显示模板 MaritialStatusEnum.ascx
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%=((MilitaryStatusEnum)Model == .MilitaryStatusEnum.Serving)? "Serving" : "Finished"
%>
编辑器模板
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<AlefTech.HumanResource.Core.MartialStatusEnum>" %>
<%=Html.DropDownList("MartialStatus", new SelectListItem[] { new SelectListItem { Text = "Serving", Value = "0" }, new SelectListItem { Text = "Finished", Value = "1" } }) %>
任何想法为什么会发生这种情况?