or
@(Html.Kendo().Grid<
projectInfoViewModel
>()
.Name("grid2")
.Columns(cols =>
{
cols.Bound(e => e.OrgID).Tital("View Detail").Template(e => { }).ClientTemplate(" ");
cols.Bound(e => e.OrgName).Title("Organization");
})
.DataSource(dataSource => dataSource.Ajax()
.Read(read => read.Action("Index", "Summary"))
)
.ClientRowTemplate(
"<
tr
>" +
"<
td
>" +
@Html.ActionLink("#: OrgID#", "Index", "Info", new orgViewModel { oID = int.Parse("#: OrgID#"), uID = int.Parse("#: UserID#") }, null) +
"</
td
>" +
"<
td
>" +
"
#: City #
<
br
/>" +
"
#: ProvinceText#
<
br
/>" +
"
#: CountryText#
" +
"</
td
>" +
"</
tr
>"
)
@(Html.Kendo().Grid(Model)
.Name("grid")
.Columns(cols =>
{
cols.Bound(c => c.OrgID).Template(e => { });
cols.Bound(c => c.UserID);
cols.Bound(c => c.IsAssigned);
})
.RowTemplate(@<
text
>
@item.OrgName<
br
/>
@item.City, @item.ProvinceText, @item.CountryText
</
text
>)
)
@(Html.Kendo().Grid(Model)
.Name(
"Programas"
)
.Columns(columns =>
{
columns.Bound(t => t.Programa.ProgramaId).Title(
"Programa"
);
for
(var i = 0; i < ViewBag.num; i++)
{
columns.Bound(e => e.Empresas[i].Selected).ClientTemplate(
"#=funcao(Empresas["
+ i +
"])#"
);
}
})
.Filterable()
.ToolBar(tb => tb.Save()
.Editable(ed => ed.Mode(GridEditMode.InCell))
.DataSource(data => data
.Ajax()
.Model(mod => {
mod.Id(m => m.Programa.ProgramaId);
})
.Batch(
true
)
.Read(read =>read.Action(
"GetProgramas"
,
"ProgramaRede"
,
new
{ id = ViewBag.RedeId}))
.Update(up =>up.Action(
"UpdateProgramas"
,
"ProgramaRede"
,
new
{ id = ViewBag.RedeId })
)))
function
set(line, checkbox) {
var
state = $(line).is(
':checked'
);
var
grid = $(
'#Programas'
).data().kendoGrid;
var
dataSource = grid.dataSource.view()[line.id]
for
(
var
c = 0; c < dataSource.Empresas.length; c++)
if
(dataSource.Empresas[c].Value == checkbox) {
dataSource.Empresas[c].set(
"Selected"
, state)
dataSource.dirty =
true
;
}
}
function
funcao(emp, prog) {
retorno =
"<input type='checkbox' onclick='set(this,\""
+ emp.Value +
"\")' class='chkbx' id="
+ prog +
" "
+ ((emp.Selected) ?
"checked = 'checked'"
:
''
) +
" class='chkbx' />"
;
return
retorno;
}
[AcceptVerbs(HttpVerbs.Post)]
public
ActionResult UpdateProgramas(
short
id, [DataSourceRequest] DataSourceRequest request, [Bind(Prefix =
"models"
)] IEnumerable<ProgramaRedeViewModel> model)
{
///////function to editing
}