Hi guys, currently i have this scenario where i want to get the selected row id after clicking on the edit button and pass that id to the action method...
Please let me know if this is possible. here is my code below that i have gathered so far...
function disableOnEdit(e) {
var model = e.model; //gets the model of the currently edited row
var Department = model.DepartmentID; //gets the value of the field "Department"
$.ajax({
type: "POST",
data: Department,
url: '@Url.Action("GetUsers","Home")',
success: function (result) {
console.log(result);
}
})
$(".k-edit-form-container").parent().width(520).height(500).data("kendoWindow").center();
}
and my grid code below
<
div
style
=
"clear:both; position:relative; padding-top: 10px"
>
@(Html.Kendo().Grid<
KendoUIApp1_Test.Models.IncidentsViewModel
>()
.Name("grid")
.Columns(colums =>
{
*/
colums.Bound(p => p.DepartmentID).Hidden(true);
colums.Bound(p => p.IncidentID).ClientTemplate("<
a
class
=
'k-button'
href
=
'" + Url.Action("GetPDF", "Home") + "?IncidentID=#= IncidentID #'
" + "> <
span
span
class
=
'k-icon k-i-pdf'
'></
span
>Get Incident Pdf</
a
>").Title("Download PDF").Filterable(false);
colums.Bound(p => p.StatusName).Title("Status").Filterable(false);
colums.Bound(p => p.ReferenceNo).Title("ReferenceNo").Filterable(false);
colums.Bound(p => p.IncidentDate).Title("IncidentDate").ClientTemplate("#= kendo.format('{0:MM/dd/yyyy HH:mm:ss}',kendo.parseDate(IncidentDate)) #").Filterable(model => model.UI("IncidentDateFilter"));
colums.Bound(p => p.AccountName).Title("AccountName").Filterable(false);
colums.Bound(p => p.Department1).Title("Department").Filterable(false);
colums.Bound(p => p.Description).Title("Description").Filterable(false);
colums.Bound(p => p.Comments).Title("Comments").Filterable(false);
colums.Bound(p => p.FirstName).Title("CurrentAssignedUser").Filterable(false);
colums.Command(cmd => cmd.Edit());
})
.Filterable(filterable => filterable
.Extra(true)
.Operators(operators => operators
.ForString(str => str.Clear()
.StartsWith("Starts with")
.IsEqualTo("Is equal to")
.IsNotEqualTo("Is not equal to")
))
)
.HtmlAttributes(new { style = "height:550px;" })
.DataSource(datasource => datasource
.Ajax() //Configure the grid data source
.Events(Eevents => Eevents.RequestEnd("OnChangeRefresh"))
.Model(model =>
{
model.Id(m => m.IncidentID);
})
.Read(read =>
{
read.Action("GetIncidents", "Home").Data("IncidentsFilter");
})// set the action method which will return the data in json format
.Update(update => update.Action("Incidents_Update", "Home"))
)
.Navigatable()
.Groupable()
.Pageable()
.Reorderable(reorder => reorder.Columns(true))
.Sortable()
.Scrollable()
.Events(events =>
{
events.Save("onIncidentUserAssign");
// events.Save("onStatusChange");
})
.Events(eEvents => eEvents.Edit("disableOnEdit"))
//.Events(events =>
//{
// events.Save("onStatusChange");
// // events.Save("onStatusChange");
//})
.Editable(ed => ed.Mode(GridEditMode.PopUp).TemplateName("Incidents")
.Window(w => w.Title("Edit Incident Details")
.HtmlAttributes(new {@class= "kendo-popup-editor" })
.Scrollable(false)
.Name("editWindow")))
)