I have a grid in which the first column of the Grid is a drop down (ForeignKey column), while all other columns are readonly. Whenever user makes a selection, I want all the readonly columns be populated with relevant data against the selection made in the drop down column. For example: Drop down column is the Badge No of the employees, when user selects a badge #, I want first name, last name etc. populated for the selected badge # in other columns for that particular row only. How can I achieve this?
01.
@(Html.Kendo().Grid<
IMCC.TrainingTracker.Models.EmployeeMasterViewModel
>()
02.
.Name("trainersGrid")
03.
.Columns(columns =>
04.
{
05.
columns.ForeignKey(c => c.emp_badge_no, (SelectList)(ViewBag.employees)).Width(90);
06.
columns.Bound(c => c.emp_first_name);
07.
columns.Bound(c => c.emp_last_name);
08.
columns.Bound(c => c.emp_company).Width(150);
09.
columns.Bound(c => c.emp_designation_text).Width(150);
10.
columns.Bound(c => c.emp_email_address).Width(120);
11.
})
12.
.Editable(editable => editable.Mode(GridEditMode.InCell))
13.
.ColumnMenu()
14.
.Pageable(p => p.Refresh(true).PageSizes(true))
15.
.Selectable(selectable =>
16.
{
17.
selectable.Mode(GridSelectionMode.Single);
18.
selectable.Type(GridSelectionType.Row);
19.
})
20.
.Sortable(sortable =>
21.
{
22.
sortable.SortMode(GridSortMode.MultipleColumn);
23.
})
24.
.Events(e => e.Edit("onEdit"))
25.
.Filterable()
26.
.Resizable(r => r.Columns(true))
27.
.Events(events =>
28.
{
29.
events.Change("onGridChange"); events.DataBound("onGridDataBound");
30.
})
31.
.DataSource(dataSource => dataSource
32.
.Ajax()
33.
.Model(model =>
34.
{
35.
model.Id(p => p.id);
36.
model.Field(p => p.emp_first_name).Editable(false);
37.
model.Field(p => p.emp_last_name).Editable(false);
38.
model.Field(p => p.emp_company).Editable(false);
39.
model.Field(p => p.emp_designation_text).Editable(false);
40.
model.Field(p => p.emp_email_address).Editable(false);
41.
})
42.
.Read(read => read.Action("CourseTrainers_Read", "CourseTrainer").Data("GetCurrentCourse"))
43.
Update(update => update.Action("CourseMaster_Update", "CourseMaster"))
44.
.Destroy(destroy => destroy.Action("CourseMaster_Destroy", "CourseMaster"))
45.
)
46.
)