or
@(Html.Kendo().Grid<
tblAttachFile
>()
.Name("tblAttachFile")
.BindTo(Model.tblAttachFiles)
.Columns(col =>
{
col.Bound(p => p.Attach_File_Name).Title("File Name");
col.Bound(p => p.Attach_File_Path).Title("File Path");
col.Bound(p => p.Attach_File_Description).Title("File Description");
col.Command(cmd => cmd.Edit());
})
//.ToolBar(toolbar => toolbar.Create())
.Editable(ed => ed.Mode(GridEditMode.PopUp).Window(w => w.Name("winEdit").Title("My Test").Content("Loading").LoadContentFrom("Edit", "AttachFile", new { id = 1 })))
.Pageable()
.Sortable()
.Scrollable()
.DataSource(ds => ds
.Server()
.Model(m => m.Id(p => p.Attach_File_ID))
.Update("Edit", "AttachFile")
)
)
// GET: /tblAttachFiles/Edit/5
[Authorize]
public ActionResult Edit(int id)
{
tblAttachFile tblattachfile = tblattachfileRepository.GetOne(id);
ControllerHelper.filePath = tblattachfile.Attach_File_Path;
return View(tblattachfile);
}
//
// POST: /tblAttachFiles/Edit/5
[AcceptVerbs(HttpVerbs.Post), Authorize]
public ActionResult Edit(int id, FormCollection collection)
{
tblAttachFile tblattachfile = tblattachfileRepository.GetOne(id);
try
{
tblattachfile.Attach_File_Path = ControllerHelper.filePath;
ControllerHelper.filePath = "";
tblattachfile.Updated_Date = DateTime.Now;
tblattachfile.Updated_By = User.Identity.Name;
UpdateModel(tblattachfile);
tblattachfileRepository.Save();
return RedirectToAction("Detail", new { id = tblattachfile.Attach_File_ID });
}
catch
{
ModelState.AddRuleViolations(tblattachfile.GetRuleViolations());
return View(tblattachfile);
}
}
Dear Kendo support team,
I use Kendo UI grid within a Bootstrap Responsive Layout and would like to add 2 items to the grid's column menu.
One for increasing the current column width by a certain amount and one for the shrinking the width. Ideally I would like to have an icon as menuitem.
Please give me some advise how to manage this.
Thank you in advance
@(Html.Kendo().ListView<Kendo.Mvc.Examples.Models.ProductViewModel>(Model)
.Name("listView")
.TagName("div")
.ClientTemplateId("template")
.DataSource(dataSource => {
dataSource.Read(read => read.Action("Products_Read", "ListView"));
dataSource.PageSize(12);
})
.Pageable()
)
Though we mention 12 in the pagesize, I am getting all my records to the view. Please help how to show the no. of
records as per our choice.
Regards,
Rohit
var ds = new kendo.data.DataSource({ transport: { read: { url: 'url to get data', dataType: "json" } }, change: OnDataChange, requestStart: OnDataRequestStart });
function OnDataChange(e) {
if (IsDataRequested) {
// save it to cache
$.jStorage.set("LargeData", e.sender.data());
IsDataExists = true;
IsDataRequested = false;
}
}
function OnDataRequestStart(e) {
if (IsDataExists) {
e.preventDefault();
}
else {
// Check if "key" exists in the storage
var value = $.jStorage.get("LargeData");
if (value) {
IsDataExists = true;
e.preventDefault();
e.sender.data(value);
}
else {
// Read data from server
IsDataRequested = true;
}
}
}
<script id="template" type="text/x-kendo-template">
</script>
var
obj = [
{
"street_id"
:
"1"
,
"street_name"
:
"First St"
,
"addresses"
: [
{
"street_number"
:
"100"
,
"notes"
:
"Example notes..."
},
{
"street_number"
:
"101"
,
"notes"
:
""
}
]
},
{
"street_id"
:
"2"
,
"street_name"
:
"Second St"
,
"addresses"
: [
{
"street_number"
:
"200"
,
"notes"
:
""
},
{
"street_number"
:
"201"
,
"notes"
:
"Test notes..."
}
]
}
];
var
template = kendo.template($(
'#template'
).html());
var
dataSource =
new
kendo.data.DataSource({
data: obj,
filter: {
field:
'street_id'
,
operator:
'eq'
,
value: e.view.params.street_id
},
change:
function
() {
$(
'#streets'
).html(kendo.render(template,
this
.view()));
}
});
dataSource.read();
$(this).kendoComboBox({
filter: "contains",
height: 200,
change: function (e) {
if (this._selected == null) {
this.text("(None)");
}
}
});