or
@(Html.Kendo().Grid(Model)
.Name("grid")
.Columns(columns =>
{
foreach (System.Data.DataColumn column in Model.Columns)
{
var c = columns.Bound(column.ColumnName);
}
})
.ToolBar(tools => tools.Excel())
.Pageable()
.Sortable()
.Scrollable()
.Excel(excel => excel
.FileName("Export.xlsx")
.Filterable(true)
.ProxyURL(Url.Action("Excel_Export_Save", "Reports"))
)
.HtmlAttributes(new { style = "height:430px;" })
.DataSource(dataSource => dataSource
.Server()
.Model(model =>
{
foreach (System.Data.DataColumn column in Model.Columns)
{
var field = model.Field(column.ColumnName, column.DataType);
}
})
)
)
[HttpPost]
public ActionResult Excel_Export_Save(string contentType, string base64, string fileName)
{
var fileContents = Convert.FromBase64String(base64);
return File(fileContents, contentType, fileName);
}
$("#save").click(function () {
var lv = $("#imageListView").data("kendoListView");
var model = lv.dataSource.get(9);
var index = lv.dataSource.indexOf(model);
var pg = Math.floor(index / lv.dataSource.pageSize()) + 1;
lv.dataSource.page(pg);
}
@(Html.Kendo().Grid<
DL.Data.PayCodes
>()
.Name("grdPayCodes")
.Columns(columns =>
{
columns.Bound(p => p.pay_code).Width(120).Title("Code");
columns.Bound(p => p.color).Width(75).Title("Color").ClientTemplate("<
div
style
=
'width: 100%; text-align: center;'
><
div
style
=
'width: 25px; height: 25px; background: #=color#; -moz-border-radius: 17px; -webkit-border-radius: 17px; border-radius: 17px; margin: auto; #= SetBorder(this, color)#'
></
div
></
div
>");
columns.Bound(p => p.description).Title("Description");
columns.Command(command => { command.Edit(); command.Custom("Delete").Click("DeletePayCodes_Click"); }).Width(180).HtmlAttributes(new { style = "text-align: center;" });
})
.ToolBar(toolbar => toolbar.Create())
.Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("PayCodesAddRecordTemplate"))
.Sortable()
.Scrollable()
.HtmlAttributes(new { style = "height:430px; margin-top: 7px;" })
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => model.Id(p => p.pay_code))
.Create(update => update.Action("CreatePayCodes", "Settings"))
.Read(read => read.Action("GetPayCodesDSGrid", "Common"))
.Update(update => update.Action("UpdatePayCodes", "Settings"))
.Events(events => events.Error("grdPayCodes_ErrorHandler").RequestEnd("grdPayCodes_RequestEnd"))
)
.Events(ev => ev.DataBound("grdPayCodes_DataBound").Edit("grdPayCodes_Edit"))
)
<
table
style
=
"margin-left: 5%; width: 90%;"
>
<
tr
>
<
td
class
=
"label-cell"
>
<
label
for
=
"pay_code"
>Code</
label
>
</
td
>
<
td
>
<
input
id
=
"pay_code"
name
=
"pit_name"
class
=
"data-cell"
data-bind
=
"value: pay_code"
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"label-cell"
>
<
label
for
=
"color"
>Color</
label
>
</
td
>
<
td
>
@(Html.Kendo().ColorPicker()
.Name("color")
.Value("#ffffff")
)
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"label-cell"
>
<
label
for
=
"description"
>Description</
label
>
</
td
>
<
td
>
<
input
id
=
"description"
name
=
"description"
class
=
"data-cell"
data-bind
=
"value: description"
>
</
td
>
</
tr
>
</
table
>