Hi all,
I need a solution for ASP.NET MVC Grid Razor
i have a Grid InCell Edit Mode.
One Column Date
One Column as ForeignKey Column (Possible Values before Date: 01.07.2023 are [A, B, C] and At 01.07.2023 and later possible Values are [D, E]
Is there a solution how to change the selectlist by data of current row?
Regards
Gerd
I have a solution for that problem:
add to the foreignkey clumn a client template and a editor template
the client template call the js function:
and for the editor template
Generate a dropdownlist and add to the grid the edit event
while the edit event:
replace the datasource of dropdownlist
the dropdownlist is named by column binding name.
the edit event has the Model with date column
var ddl = $("#Foreignkeyname").data("kendoDropDownList");if (ddl) {
var kendoDs;
const dateToCompare = new Date("2023-06-30");
if ((dateToCompare - new Date(kendo.format("{0:yyyy-MM-dd}", e.model.Date))) >= 0) {
kendoDs = new kendo.data.DataSource({
data: [{ Value: "-1", Text: "Please select" },{ Value: "1", Text: "A" },{ Value: "2", Text: "B" }]
});
} else {
kendoDs = new kendo.data.DataSource({
data: [{ Value: "-1", Text: "No" }, { Value: "1", Text: "Yes" }]
});
}
ddl.setDataSource(kendoDs);
}