or
var openAssetEditor = function (e) {
var window = $('#AssetEditorPopUp').data("kendoWindow");
window.wrapper.css({
height: 450
});
window.refresh({
url: "/Asset/AssetPopup",
data: { assetId: 0 }
});
window.center();
window.open();
};
@(Html.Kendo().Window()
.Name("AssetEditorPopUp")
.Title("Asset Editor")
.Content("loading asset info...")
.Draggable(true)
.Modal(true)
.Visible(false)
.Width(950)
)
public ActionResult AssetPopup([DataSourceRequest] DataSourceRequest request, int? assetId)
{
return PartialView("~/Views/Asset/AssetPopup.cshtml");
}
<
link
href
=
"http://cdn.kendostatic.com/2013.1.319/styles/kendo.common.min.css"
rel
=
"stylesheet"
type
=
"text/css"
/>
<
link
href
=
"http://cdn.kendostatic.com/2013.1.319/styles/kendo.dataviz.min.css"
rel
=
"stylesheet"
type
=
"text/css"
/>
<
link
href
=
"http://cdn.kendostatic.com/2013.1.319/styles/kendo.default.min.css"
rel
=
"stylesheet"
type
=
"text/css"
/>
<
link
href
=
"http://cdn.kendostatic.com/2013.1.319/styles/kendo.dataviz.default.min.css"
rel
=
"stylesheet"
type
=
"text/css"
/>
<
script
src
=
"http://code.jquery.com/jquery-1.9.1.min.js"
></
script
>
<
script
src
=
"http://cdn.kendostatic.com/2013.1.319/js/kendo.all.min.js"
></
script
>
<
script
src
=
"http://cdn.kendostatic.com/2013.1.319/js/kendo.aspnetmvc.min.js"
></
script
>
<
script
src
=
"<%= Url.Content("
~/Scripts/jquery.cookie.js") %>"></
script
>
<
link
href
=
"<%= Url.Content("
~/Content/CustomKendo.css") %>" rel="stylesheet" type="text/css" />
[Authorize]
[AcceptVerbs(HttpVerbs.Post)]
[ValidateAntiForgeryToken]
public ActionResult AjaxServiceCreate([DataSourceRequest] DataSourceRequest request, ISmServiceDto newItem, ICreateSmService service)
{
if (newItem != null && ModelState.IsValid)
{
var response = service.Create(newItem);
if (!response.IsValid)
response.CopyErrorsToModelState(ModelState);
}
return Json(new[] { newItem }.ToDataSourceResult(request, ModelState));
}
@model bool
@{
ViewBag.Title = "Services";
}
<
h2
>Services</
h2
>
@*<
div
id
=
"message"
class
=
"Message"
></
div
>*@
@Html.AntiForgeryToken()
@(Html.Kendo().Grid<
ServiceLayer.Models.DTOs.SmServiceDto
>()
.Name("Services")
.Columns(columns =>
{
columns.Bound(p => p.SmServiceId).Hidden();
columns.Bound(p => p.ShortName);
columns.Bound(p => p.FullName);
columns.Bound(p => p.Locked);
if (@Model)
{
columns.Command(command => { command.Edit(); command.Destroy(); }).Width(172);
}
})
.ToolBar(toolbar =>
{
if (@Model)
{
toolbar.Create();
}
})
.Editable(editable => editable.Mode(GridEditMode.InLine))
.Pageable()
.Sortable()
//.Scrollable()
//.HtmlAttributes(new {style = "height:430px;"})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(10)
.Events(events => events.Error("error_handler"))
.Model(model =>
{
model.Id(p => p.SmServiceId);
model.Field(x => x.SmServiceId).Editable(false);
model.Field(x => x.Locked).Editable(false);
})
.Create(x => x.Action("AjaxServiceCreate", "Model").Type( HttpVerbs.Post).Data("sendAntiForgery"))
.Read(read => read.Action("AjaxServiceRead", "Model"))
.Update(x => x.Action("AjaxServiceUpdate", "Model").Type( HttpVerbs.Post).Data("sendAntiForgery"))
.Destroy(x => x.Action("AjaxServiceDelete", "Model").Type( HttpVerbs.Post).Data("sendAntiForgery"))
))
@section scripts {
<
script
type
=
"text/javascript"
>
function error_handler(e) {
if (e.errors) {
e.preventDefault(); // cancel grid rebind if error occurs
var message = "Errors:\n";
$.each(e.errors, function (key, value) {
if ('errors' in value) {
$.each(value.errors, function () {
message += this + "\n";
});
}
});
alert(message);
}
}
function sendAntiForgery() {
return { "__RequestVerificationToken": $('input[name=__RequestVerificationToken]').val() };
}
</
script
>
}
@( Html.Kendo().Menu()
.Name("Menu")
.Items(menu =>
{
menu.Add().Text("Tasks").Action("Index", "Tasks");
@* Rest eliminated *@
})
)
jQuery(
function
(){jQuery(
"#Menu"
).kendoMenu({});});
@( Html.Kendo().TabStrip()
.Name(
"TabStrip"
)
.Items(parent =>
{
parent.Add()
.Text(
"My Tasks"
)
.Selected(
true
)
.LoadContentFrom(
"MyTasks"
,
"Tasks"
);
@* Abbreviated *@
})
)
@model Copper.Domain.Entities.EntInventory
<
div
class
=
"editor-label"
>
@Html.LabelFor(model => model.DeviceName)
</
div
>
<
div
class
=
"editor-field"
>
@Html.EditorFor(model => model.DeviceName)
</
div
>
<
div
>
<
img
alt
=
""
src
=
"@Url.Action("
GetImage", "CellInventory", new {
inventoryImageSeq
=
Model
.InventoryImageSeq })" />
</
div
>
public
FileContentResult GetImage(
string
inventoryImageSeq)
{
EntInventoryImage entImage =
new
EntInventoryImage();
int
seq;
if
(Int32.TryParse(inventoryImageSeq,
out
seq))
{
entImage = _margoRepository.GetInventoryImage((
int
?)seq);
}
return
File(entImage.ActualImage, entImage.ContentType);
}
new { inventoryImageSeq = Model.InventoryImageSeq }
command.Custom("edit").Click("editPlan");
var grid = $("#Grid").data("kendoGrid");
var Id= grid.dataItem(grid.select()).Id;