or
public
ActionResult Scans_Read([DataSourceRequest] DataSourceRequest request)
{
return
Json(GetScans().ToDataSourceResult(request));
}
private
static
IEnumerable<ScanModel> GetScans()
{
var ec =
new
entityContext();
return
ec.tScan.Select(scanmodel =>
new
ScanModel
{
scanId = scanmodel.scanId,
description = scanmodel.description,
directoryPath = scanmodel.directoryPath
});
}
public
class
ScanModel
{
[ScaffoldColumn(
false
)]
public
int
scanId
{
get
;
set
;
}
[Required]
[DisplayName(
"description"
)]
public
string
description
{
get
;
set
;
}
[Required]
[DisplayName(
"directoryPath"
)]
public
string
directoryPath
{
get
;
set
;
}
}
@model IEnumerable<
ns.Models.ScanModel
>
<
script
type
=
"text/x-kendo-tmpl"
id
=
"template"
>
<
div
class
=
"scanmodel"
>
<
h3
>#:description#</
h3
>
</
div
>
</
script
>
@(Html.Kendo().ListView<
ns.Models.ScanModel
>(Model)
.Name("listView")
.TagName("div")
.ClientTemplateId("template")
.DataSource(dataSource => {
dataSource.Read(read => read.Action("Scans_Read", "CustomerPortal"));
})
)
@(Html.Kendo().Grid<
MyParentGridModel
>()
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.Id).Groupable(false).Width(50);
columns.Bound(p => p.Name);
columns.Bound(p => p.ShortDescription);
columns.Bound(p => p.LinkText);
})
.Sortable()
.Pageable()
.Scrollable(scr=>scr.Height(500))
.ClientDetailTemplateId("template")
.HtmlAttributes(new { style = "height:430px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("ParentModel_Read", "ControllerName"))
)
)
<
script
id
=
"template"
type
=
"text/kendo-tmpl"
>
@(Html.Kendo().Grid<
ChildGridModel
>()
.Name("Grid_#=Id#")
.Columns(columns =>
{
columns.Bound(o => o.PageNumber).Width(50);
columns.Bound(o => o.ChapterTitle).Width(150);
columns.Bound(o => o.BodyContent);
columns.Template(@<
text
>
@Html.ActionLink("edit", "ControllerAction", "ControllerName", new { id = @item.Id }, new {@class = "k-button" })
</
text
>)
.ClientTemplate(@Html.ActionLink("edit", "ControllerAction", "ControllerName", new { ID = "#=Id#" }, new { @class = "k-button" }).ToHtmlString());
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(10)
.Read(read => read.Action("ChildModel_Read", "ControllerName", new { parentModelId = "#=Id#" }))
)
.Pageable()
.Sortable()
.ToClientTemplate()
)
</
script
>
<script type=
"text/javascript"
>
function
onChange(e) {
$.ajax({
url:
"/Nav/MontaMenu/"
,
dataType:
"json"
,
cache:
false
,
type:
'GET'
,
data: { nomePastaSelecionada:
this
.text(), caminhoPastaSelecionada:
this
.value() },
success:
function
(result) {
$(
'#treeview'
).kendoTreeView();
var
tvProjeto = $(
'#treeview'
).getKendoTreeView();
tvProjeto.destroy();
var
dataSource =
new
kendo.data.DataSource({
data: result
});
dataSource.fetch(
function
() {
tvProjeto.setDataSource({
data: dataSource
});
});
}
});
}
</script>
function LayoutChange() {
UpdateGridSize("#PendingVessels", 0);
UpdateGridSize("#DueToSellVessels", 1);
UpdateGridSize("#DueToShiftVessele", 2);
}
function UpdateGridSize(gridName, indexPane) {
var splitter = $("#Main");
var splitterPane = splitter.find(".k-pane")[indexPane];
var splitterHeight = splitterPane.scrollHeight;
var gridElement = $(gridName),
dataArea = gridElement.find(".k-grid-content"),
//gridHeight = gridElement.innerHeight(),
otherElements = gridElement.children().not(".k-grid-content"),
otherElementsHeight = 0;
otherElements.each(function () {
otherElementsHeight += $(this).outerHeight();
});
gridElement.height(splitterHeight - 25); //-25 for the header item
dataArea.height(gridElement.innerHeight() - otherElementsHeight);
}
return this.Json((new Model[] { singleModelRecord }).ToDataSourceResult(request, this.ModelState));
return this.Json(arrayOfModels.ToDataSourceResult(request, this.ModelState));
@(Html.Kendo().Upload()
.Name("ImageUpload")
.Multiple(false)
.Async(a => a
.Save("UploadImage", "Home")
.AutoUpload(false)
)
.Events(e =>
{
e.Error("UploadError");
e.Success("GetImagePreviews");
})
)