Hi Support,
I am trying to use FLEET_CUSTOM_FIELD_VALUE field for multiple data type while editing in grid,
so i tried using if condition for value coming through FLEET_CUSTOM_FIELD_DATATYPE field in column but it's giving me error.
Any suggestion will be great.
public class CustomFieldValue
{
public int FLEET_ID { get; set; }
public int FLEET_CUSTOM_FIELD_ID { get; set; }
public string FLEET_CUSTOM_FIELD_VALUE { get; set; }
public string FLEET_CUSTOM_FIELD_DESCRIPTION { get; set; }
public string FLEET_CUSTOM_FIELD_DATATYPE { get; set; }
public short FIELD_POSITION { get; set; }
public string USER_UPDATE { get; set; }
}
@(Html.Kendo().Grid<CustomFieldValue>()
.Name("CustomFieldValue" + @ViewData["FLEET_ID"])
.Sortable()
.Pageable(paging =>
{
paging.Enabled(true);
paging.Info(true);
paging.PageSizes(true);
paging.Numeric(true);
paging.PreviousNext(true);
paging.Refresh(true);
paging.PageSizes(new int[5] { 5, 10, 15, 20, 25 });
})
.DataSource(dataSource => dataSource
.Ajax()
.Events(events =>
{
events.RequestEnd("onCustomFieldValueRequestEnd");
events.Error("onCustomFieldValueListError");
})
.PageSize(15)
.Model(model =>
{
model.Id(f => f.FLEET_CUSTOM_FIELD_ID);
model.Field(f => f.FLEET_CUSTOM_FIELD_DESCRIPTION).Editable(false);
})
.Read(read => read.Action("_CustomFieldValueList", "CustomFieldValueList", new { fleetId = ViewData["FLEET_ID"] }))
.Update(update => update.Action("_CustomFieldValueListEdit", "CustomFieldValueList"))
)
.Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
.Editable(editable =>
{
editable.Mode(GridEditMode.InLine);
})
.Reorderable(reorder => reorder.Columns(true))
.Filterable()
.Columns(columns =>
{
columns.Bound(f => f.FLEET_CUSTOM_FIELD_ID).Title(" ").Hidden();
columns.Bound(f => f.FLEET_CUSTOM_FIELD_DATATYPE).Title(" ").Hidden();
columns.Bound(f => f.FLEET_CUSTOM_FIELD_DESCRIPTION).Title("Description");
if ("#=FLEET_CUSTOM_FIELD_DATATYPE#" == "D")
{
columns.Bound(f => f.FLEET_CUSTOM_FIELD_VALUE).Title("Field value").EditorTemplateName("_Date").Width(250);
}
else
{
columns.Bound(f => f.FLEET_CUSTOM_FIELD_VALUE).Title("Field value").Width(250);
}
columns.Command(command =>
{
command.Edit();
}).Width(250).Title("Commands").HeaderHtmlAttributes(new { @style = "text-align:left; text-decoration:Underline;" });
})
.Events(e=>e.Edit("edit"))
)
I am trying to use FLEET_CUSTOM_FIELD_VALUE field for multiple data type while editing in grid,
so i tried using if condition for value coming through FLEET_CUSTOM_FIELD_DATATYPE field in column but it's giving me error.
Any suggestion will be great.
public class CustomFieldValue
{
public int FLEET_ID { get; set; }
public int FLEET_CUSTOM_FIELD_ID { get; set; }
public string FLEET_CUSTOM_FIELD_VALUE { get; set; }
public string FLEET_CUSTOM_FIELD_DESCRIPTION { get; set; }
public string FLEET_CUSTOM_FIELD_DATATYPE { get; set; }
public short FIELD_POSITION { get; set; }
public string USER_UPDATE { get; set; }
}
@(Html.Kendo().Grid<CustomFieldValue>()
.Name("CustomFieldValue" + @ViewData["FLEET_ID"])
.Sortable()
.Pageable(paging =>
{
paging.Enabled(true);
paging.Info(true);
paging.PageSizes(true);
paging.Numeric(true);
paging.PreviousNext(true);
paging.Refresh(true);
paging.PageSizes(new int[5] { 5, 10, 15, 20, 25 });
})
.DataSource(dataSource => dataSource
.Ajax()
.Events(events =>
{
events.RequestEnd("onCustomFieldValueRequestEnd");
events.Error("onCustomFieldValueListError");
})
.PageSize(15)
.Model(model =>
{
model.Id(f => f.FLEET_CUSTOM_FIELD_ID);
model.Field(f => f.FLEET_CUSTOM_FIELD_DESCRIPTION).Editable(false);
})
.Read(read => read.Action("_CustomFieldValueList", "CustomFieldValueList", new { fleetId = ViewData["FLEET_ID"] }))
.Update(update => update.Action("_CustomFieldValueListEdit", "CustomFieldValueList"))
)
.Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
.Editable(editable =>
{
editable.Mode(GridEditMode.InLine);
})
.Reorderable(reorder => reorder.Columns(true))
.Filterable()
.Columns(columns =>
{
columns.Bound(f => f.FLEET_CUSTOM_FIELD_ID).Title(" ").Hidden();
columns.Bound(f => f.FLEET_CUSTOM_FIELD_DATATYPE).Title(" ").Hidden();
columns.Bound(f => f.FLEET_CUSTOM_FIELD_DESCRIPTION).Title("Description");
if ("#=FLEET_CUSTOM_FIELD_DATATYPE#" == "D")
{
columns.Bound(f => f.FLEET_CUSTOM_FIELD_VALUE).Title("Field value").EditorTemplateName("_Date").Width(250);
}
else
{
columns.Bound(f => f.FLEET_CUSTOM_FIELD_VALUE).Title("Field value").Width(250);
}
columns.Command(command =>
{
command.Edit();
}).Width(250).Title("Commands").HeaderHtmlAttributes(new { @style = "text-align:left; text-decoration:Underline;" });
})
.Events(e=>e.Edit("edit"))
)