I currently have the grid below. And I am trying to make a different popup for when someone is creating a new entry vs editing the existing one. Mainly to show different fields and such. How do I go about doing so?
Whether I click on the Create() on the AddNewRecord or the edit, it hits the Edit() event or BeforeEdit() when I switch to that so they end up calling the same Javascript function. And within that function I cant seem to find a way to determine which button was pressed. On here I can only find this reference: Custom Popup Editor for Create and Edit in UI for ASP.NET Core | Telerik Forums , but it doesnt use the same syntax.
<div id="minutesDiv">
@Html.Kendo().Grid(Model.MinutesList).Name("MinutesGrid").Size(ComponentSize.Small).Editable(GridEditMode.PopUp).Resizable(r => r.Columns(true)).ToolBar(x =>
{
x.Create();
}).Columns(col =>
{
col.Bound(c => c.MinuteDate).Title("Date Created").Width(100);
col.Bound(c => c.CreatedBy).Title("Entered By").Width(200);
col.Bound(c => c.Minute).Title("Minutes").Width(200);
col.Command(c =>
{
c.Edit();
c.Destroy();
}).Width(170);
}).Events(e =>
{
e.Edit("HideFieldsOnEdit");
}).Sortable().DataSource(dataSource => dataSource
.Ajax()
.Read(r => r.Url("/Appearances/OutcomeInformation?handler=Read").Data("forgeryToken"))
.Update(r => r.Url("/Appearances/OutcomeInformation?handler=Update").Data("forgeryToken"))
.Create(r => r.Url("/Appearances/OutcomeInformation?handler=Create").Data("forgeryToken"))
.Destroy(r => r.Url("/Appearances/OutcomeInformation?handler=Destroy").Data("forgeryToken"))
.Model(model =>
{
model.Field(Field => Field.MinuteDate);
model.Field(Field => Field.CreatedBy);
model.Field(Field => Field.Minute);
}))
</div>
function HideFieldsOnEdit(e){ e.container.find("#MinuteID").hide(); e.container.find("label[for='MinuteID']").hide(); e.container.find("#CreatedBy").hide(); e.container.find("label[for='CreatedBy']").hide(); e.container.find("#MinuteDate").hide(); e.container.find("label[for='MinuteDate']").hide(); e.container.find("#FileID").hide(); e.container.find("label[for='FileID']").hide(); }