I have the following grid
<
div
class
=
"actualGrid"
id
=
"actualGrid"
>
@(Html.Kendo().Grid<
AVNO_KPMG.Models.Bench
>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.name).Title("Bench").Filterable(ftb => ftb.Cell(cell => cell.Operator("contains"))).Width(125);
columns.Bound(p => p.freeSeats).Title("Free Seats").Width(350)
;
columns.Command(command => { command.Custom("checkBench1 ").Text(" AM ").Click("doCheckIn"); command.Custom("checkBench 2").Text(" PM ").Click("doCheckIn"); command.Custom("checkBench3").Text("All Day").Click("doCheckIn"); }).Width(250).Title("Check in");
})
//.Editable(editable => editable.Mode(GridEditMode.PopUp))
.Pageable()
.Sortable()
.Scrollable()
.Filterable(ftb => ftb.Mode(GridFilterMode.Row))
.HtmlAttributes(new { style = "height:530px;" })
.Events(events => events.DataBound("onDataBound"))
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Events(events => events.Error("error_handler"))
.Model(model => model.Id(p => p.id))
.Read(read => read.Action("GetBenches", "Home"))
)
)
</
div
>
I would like to know if there is a way to change the size of the grid according to the number of results i have when i use filter
for Example if i filter first column and get 1 result grid would be small, and if i had 10 results i would be larger.
Hello,
Could you please let me know how one can control the placement of the slider tooltip? By default it is to bottom and the ask is to have it placed above.
Thanks!
Hello, I'm currently evaluating the MVC controls. I've created a custom control panel where the user can filter or create new items on the table. Currently the filter is working perfectly using javascript. The create button is not. I added the class k-grid-add but no luck. I look at the link the grid creates when using the standard create button in the toolbar and it looks something like this: tblAgents_Read?grid-mode=insert . I've tried adding this link to my custom link but it will return all data in a json file. Any help?
Hi,
we need to bind datatables to a grid. For that we found the following example code:
http://www.telerik.com/support/code-library/binding-to-datatable-0191a594e359
This is working fine with the following exception:
We need a custom popup editor. But this requires a model we do not have because the grid is <dynamic>. What can we do?
Best regards,
Thomas
Hi,
I have a frustrating issue with fields in my model not being populated in the Update action callback in my controller. The model:
public class CountsPerMonthModel
{
[Editable(false)]
public int Id { get; set; }
public UserModel User { get; set; }
public int January { get; set; }
public int February { get; set; }
public int March { get; set; }
public int April { get; set; }
public int May { get; set; }
public int June { get; set; }
public int July { get; set; }
public int August { get; set; }
public int September { get; set; }
public int October { get; set; }
public int November { get; set; }
public int December { get; set; }
}
The User property is being correctly populated. Integer fields January through December are not.
The callback:
[HttpPost]
public ActionResult CountsPerMonthUpdate([DataSourceRequest] DataSourceRequest request, CountsPerMonthModel model)
{
// model has User set, but January through December are always 0
// digging into request, the values are set correctly
}
And finally, the code for the popup template:
@model App.Models.​CountsPerMonthModel
<
ul
class
=
"errors"
></
ul
>
<
div
class
=
"editor-label"
>
@Html.LabelFor(m => m.​User)
</
div
>
<
div
class
=
"editor-field"
>
@(Html.Kendo().DropDownListFor(m => m.​User)
.Name("​User")
.OptionLabel("Select ​user...")
.DataTextField("DisplayName")
.DataValueField("UserId")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("Get​Users", "Management", new { includeReadOnly = false });
});
})
)
</
div
>
<
div
>
<
p
>@Html.Label("​Counts Per Month")</
p
>
</
div
>
<
div
class
=
"editor-label"
>
@Html.LabelFor(m => m.January)
</
div
>
<
div
class
=
"editor-field"
>
@Html.EditorFor(m => m.January)
@Html.ValidationMessageFor(m => m.January)
</
div
>
<
div
class
=
"editor-label"
>
@Html.LabelFor(m => m.February)
</
div
>
... snipped for brevity ...
<
div
class
=
"editor-field"
>
@Html.EditorFor(m => m.February)
@Html.ValidationMessageFor(m => m.February)
</
div
>
<
<
div
class
=
"editor-label"
>
@Html.LabelFor(m => m.December)
</
div
>
<
div
class
=
"editor-field"
>
@Html.EditorFor(m => m.December)
@Html.ValidationMessageFor(m => m.December)
</
div
>
@Html.HiddenFor(m => m.Id)
When given a populated model, the values are displayed correctly in each field, it is only when Update is clicked, any updated values in the fields are not populated into the model object in the callback.
Any thoughts on what the issue might be? I've used similar code in other places, this is the first time though that any fields have been an int type, so am wondering if I'm missing something somewhere...
Also, the editor template for Integer is as follows:
@model int?
@(Html.Kendo().IntegerTextBoxFor(m => m)
.HtmlAttributes(new { style = "width:100%" })
.Min(int.MinValue)
.Max(int.MaxValue)
)
Thanks,
Craig.
I have a DataSet that I'm generating on the fly.
I'm doing this by collecting all of my data and then building a DataTable and then using the DataTable as a DataSource for my Kendo Grid.
The Grid is set up to use AutoGenerated columns, like this ...
@(Html.Kendo().Grid(Model.Data)
.Name(
"grid"
)
.Columns(c =>
{
c.AutoGenerate(
true
);
}
.Scrollable()
.Resizable(a =>
{
a.Columns(
true
);
})
)
I want to freeze the first column in this Grid (I will always know what this column is).
I haven't found a way of manipulating the Columns at all when using AutoGenerated columns and have had to resort to a number of jQuery/CSS 'fudges' to get the Grid looking and behaving the way that I want it to.
However, I'm at a loss as to how I might be able to freeze a column when the Grid uses AutoGenerated columns.
Is is actually possible?
If it is, would you care to give me a hint as to how I might go about it?
Hello,
sometimes when I try to Upload files via the upload-control the upload ends up in 103% without the save and onsuccess-events firing. It doesn't seem to have anything to do with the file itself, as I'm always using the same. Sometimes it works, sometimes it doesn't.
function onSuccess(e) {
var gridNotification = $("#gridNotification").data("kendoNotification");
var crmType = $("#ddlCrmType").data("kendoDropDownList");
var csvHeadRow = e.response.csvHeadRow
var url = '@Url.Action(MVC.Mapping.ReturnMappingGrid())';
$.ajax({
type: "POST",
url: url,
data: JSON.stringify({ csvHead: csvHeadRow, crmType: crmType.text() }),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
$('#gridContainer').html(data);
gridNotification.show("Die Auswahl der jeweiligen Eigenschaft erfolgt durch Klicken des jeweiligen Eigenschaft-Felds!")
var container = $(gridNotification.options.appendTo);
},
error: function (xmlHttpRequest, textStatus, errorThrown) {
debugger;
console.log(xmlHttpRequest.responseText);
console.log(textStatus);
console.log(errorThrown);
},
async: false
});
}
@(Html.Kendo().Upload()
.Name("upMappingFile")
.Multiple(false)
.ShowFileList(true)
.TemplateId("fuCsvTemplate")
.Async(a => a
.AutoUpload(true)
.Save("SaveFile", "Mapping")
.Remove("RemoveFile", "Mapping")
)
.Enable(false)
.Events(e => e
.Success("onSuccess"))
.Messages(m => m
.Select("Durchsuchen...")
.HeaderStatusUploading("Uploading...")
.HeaderStatusUploaded("Fertig"))
)
I've following code in razor view. How do I use Kendo Radio button to render the same? I'm struggling to assign enum to radio button value.
@if (Model == declaredEnum.​Val1) //declaredEnum is Enum
{
@Html.RadioButtonFor(l => l, (int)declaredEnum.​Val1, new { @checked = "checked" });
}
else
{
@Html.RadioButtonFor(l => l, (int)declaredEnum.​Val1);
}
@Html.LabelFor(l => l, "Label")​