这是从索引中调用的局部视图。在模型中,JobStatusSortOrder 设置为可为空的双精度。在这里,如果用户在内联编辑期间没有输入任何值,我如何将值默认设置为 null。我曾尝试寻找默认文本等选项,但找不到任何可以帮助我的选项。有人可以帮我吗?谢谢!
@model MyProject.Web.ViewModels.ProjectStatusListViewModel
@using MyProject.Data.Models;
@using System.Web.UI.WebControls;
@using DevExpress.Web.Mvc.UI;
@using DevExpress.Web.ASPxEditors;
@using DevExpress.Web.Mvc;
@using DevExpress.Web.ASPxGridView;
@{
Html.EnableClientValidation(true);
var grid = Html.DevExpress().GridView(
settings =>
{
settings.Name = "gvProjectStatus";
settings.KeyFieldName = "JobStatusID";
settings.Width = Unit.Pixel(1080);
settings.CallbackRouteValues = new { Controller = "Maintenance", Action = "ProjectStatusMasterPartial" };
settings.ClientSideEvents.BeginCallback = "function(s,e){e.customArgs['id'] = '" + ViewContext.RouteData.Values["JobStatusID"] + "'}";
settings.SettingsEditing.AddNewRowRouteValues = new { Controller = "Maintenance", Action = "JobStatusInlineAddNewPartial" };
settings.SettingsEditing.UpdateRowRouteValues = new { Controller = "Maintenance", Action = "JobStatusInlineEditPartial" };
settings.SettingsEditing.DeleteRowRouteValues = new { Controller = "Maintenance", Action = "JobStatusInlineDeletePartial" };
settings.SettingsEditing.Mode = GridViewEditingMode.Inline;
settings.SettingsBehavior.ConfirmDelete = true;
//Command column
settings.CommandColumn.Visible = true;
settings.CommandColumn.NewButton.Visible = true;
settings.CommandColumn.DeleteButton.Visible = true;
settings.CommandColumn.EditButton.Visible = true;
settings.CommandColumn.Caption = "Actions";
settings.CommandColumn.Width = 60; //Width is actually 100 not 60
//for filtering
settings.Settings.ShowFilterRow = true;
settings.Settings.ShowFilterRowMenu = true;
settings.CommandColumn.ClearFilterButton.Visible = true;
settings.Columns.Add(column =>
{
column.FieldName = "JobStatusID";
column.Caption = "JobStatusID";
column.Visible = false;
});
settings.Columns.Add(column =>
{
column.FieldName = "SiteID";
column.Caption = "SiteID";
column.Visible = false;
});
settings.Columns.Add(column =>
{
column.FieldName = "JobStatusName";
column.Caption = "Status Description";
column.Settings.AllowAutoFilter = DefaultBoolean.True;
});
settings.Columns.Add(column =>
{
column.FieldName = "JobStatusCurrent";
column.Caption = "Is Current";
column.ColumnType = MVCxGridViewColumnType.CheckBox;
column.Settings.AllowAutoFilter = DefaultBoolean.False;
});
settings.Columns.Add(column =>
{
column.FieldName = "JobStatusSortOrder";
column.Caption = "Sort Order";
column.Settings.AllowAutoFilter = DefaultBoolean.False;
});
});
}@grid.Bind(Model.JobStatus.ToList()).GetHtml()