@model Scripps.Partners.Web.ViewModels.
ProductionTasksViewModel
@{
ViewBag.Title =
"Index";
Layout =
"~/Views/Shared/_Layout.cshtml";
}
<
h2>Administrative Tasks</h2>
<
button id="ProductionCompanies-open-button" class="t-button t-state-default">Update Production Companies...</button>
@{
Html.Telerik().Window()
.Name(
"ProductionCompanies")
.Title(
"Production Companies")
.Content(@<text>
<div>
@
using (Html.BeginForm("ProductionCompanies", "Administration",
FormMethod.Post, new { id = "SaveProductionCompanyForm", enctype = "multipart/form-data" }))
{
<div style="margin: 20px 0 0 0;">
@{
GridEditMode mode = GridEditMode.InLine;
GridButtonType type = GridButtonType.Text;
var productionCompanyList = ViewData["ProductionCompanies"] as IEnumerable<Scripps.Partners.DatabaseModel.ProductionCompany>;
var telerikGrid = Html.Telerik().Grid(productionCompanyList).Name("TelerikGrid");
telerikGrid.Columns(columns =>
{
columns.Bound(p => p.Name).Width(100);
columns.Bound(p => p.AllowWebResource).Width(30);
columns.Bound(p => p.ProductionCompanyID).Width(30).Hidden();
columns.Command(commands => { commands.Edit().ButtonType(type); }).Width(180).Title(
"Commands");
});
telerikGrid.DataKeys(keys => keys.Add(p => p.ProductionCompanyID));
telerikGrid.DataBinding(dataBinding => dataBinding.Ajax()
.Update(
"UpdateProductionCompany", "Administration", new { mode = mode, type = type }));
telerikGrid.Filterable();
telerikGrid.Pageable();
telerikGrid.Selectable();
telerikGrid.Editable(editing => editing.Mode(mode));
telerikGrid.Render();
}
<input type="submit" value="Done" class="t-button" />
</div>
<br />
<br />
}
</div>
</text>)
.Width(400)
.Height(500)
.Draggable(
true)
.Modal(
true)
.Visible(
false)
.Render();}
@{ Html.Telerik().ScriptRegistrar()
.OnDocumentReady(@<text>
// open the initially hidden window when the button is clicked
$('#Update-open-button')
.click(function(e) {
e.preventDefault();
$('#AlphaList').data('tWindow').center().open();
});
$('#ProductionCompanies-open-button')
.click(function(e) {
e.preventDefault();
$('#ProductionCompanies').data('tWindow').center().open();
});
// add button hovers
$('.t-button').live('mouseenter', $.telerik.buttonHover)
.live('mouseleave', $.telerik.buttonLeave);</text>); }
Controller Action
[
AcceptVerbs(HttpVerbs.Post)]
[Telerik.Web.Mvc.
GridAction]
public ActionResult UpdateProductionCompany(Scripps.Partners.Web.ViewModels.ProductionCompanyViewModel data)
{
//update data to model
return????
}