Hello, I'm trying to add one kendogrid to my page and load the data received in a property of my model and then sumbit them again.
I can show items but whsn send back to controller with a submit I recevive null in controller.
Anyone could help me?
This is my current code:
View
Controller
Hello, I followed the example described here to add a new row to a grid for .net core.
All works fine as it is in the example but if I change the GridEditMode to Popup then when it opens the popup it doesn't show the editor template DropDownListFor.
Can you help me out in order to have this working with the GridEditMode.Popup ?
Thanks,
Pedro
I want to add checbox to my grid. I tried to use the Select() method but the method shows an error No overload for method Select takes 0 arguments. I need to pass to controller a collection of id elements that the user has selected.
@(Html.Kendo()
.Grid<Model>()
.Name(gridId)
.Columns(col =>
{
col.Select();
col.Bound(fds => fds.Id);
col.Bound(fds => fds.CreateDateTime).ClientTemplateDateTime();
col.Bound(fds => fds.IdClient);
})
.Pageable()
.Sortable()
.DefaultPageable()
.Resizable(c => c.Columns(true))
.AllowCopy(true)
.DataSource(d =>
d.Ajax()
.Model(m => m.Id(vm => vm.Id))
.Read("GetAnalysis", "Export")))
Hi,
I have a Model object which is used to create the parent Kendo Grid. This Model object contains a list of object which is used as a data source to another nested grid created with a ClientDetailTemplate and DetailInit event. The nested grid is coming up fine but I am unable to perform any grid operations like sorting or filtering. It does not give any error but the grid just closes down.
I think I might be missing some configuration in DetailInit event method to make sure the sorting/filtering operations does not do server operations. So I used grid.dataSource.serveroperation = false; in detailInit event. still the grid just closes in and looks like its trying to do server operation for sorting and filtering. Following is an example of the code that I am using:
public class ParentModel
{
public long ParentId { get; set; }
public List<ChildModel> ChildModelList{ get; set; }
...
}
@(Html.Kendo().Grid<ParentModel>()
.Name("Grid")
...
.ClientDetailTemplateId("nested_grid")
.Events(e => e.DetailInit("detailInit"))
...
)
<script id="nested_grid" type="text/kendo-tmpl">
@(Html.Kendo().Grid<ChildModel>()
.Name("ParentModel_#=ParentId#")
.Sortable()
.Filterable()
.ToClientTemplate()
)
</script>
<script>
function detailInit(e) {
var grid = $("#ParentModel_" + e.data.Name).data("kendoGrid");
grid.dataSource.data(e.data.ChildModelList);
grid.dataSource.serveroperation = false;
}
</script>
Hello,
My MVC project used kendo grid control which contain date column. It seems date filter does not work - after I clicking Filter button as below Page refreshed without filter. Any suggestion? Thanks in advance.
in View:
...
columns.Bound(model => model.HireDate).Width(120).Format("{0:yyyy/MM/dd}");
...
.ColumnMenu(columnMenu => columnMenu.Enabled(true).Filterable(true).Sortable(false).ComponentType("modern"))
Hi
I've explored the use of Moq. I found it useful, except for the fact that it relies heavily on code style that uses dependency injection. As I'm working on some existing legacy code, it can become quite the refactoring effort. The code base also includes some assembly references that could not be addressed via Moq.
Microsoft Fakes worked great IMHO. The only downside I saw was the requirement of VS Enterprise 2019. I'm not sure if I can get my employer to pay for the $5k/yr/developer. I really liked the ability to generate fakes on an assembly directly within VS.
Telerik's solution looks equally expensive. I've yet to explore it. Fakes, Stubs, and Mocks (telerik.com)
Prig looks viable, but looks like a pain to setup with powershell scripts, omegle etc.
Thanks
ASP.NET MVC 2020.3.915, development on an enclave network, so upgrading to newer versions takes an act of Congress, and all the code shown here is typed in by hand—meaning if there are any obvious typos, don't take that as the reason it's not working.
I have a DropDownList set up to get a fresh list of items based on Change and Close events on two DatePicker controls, and it works exactly as desired. I am trying to move this same set of controls to an (existing) preferences settings page. I copied the cshtml code verbatim and made appropriate changes, but it's not working.
Here's the control that is working. It sits inside a TabStrip control:
<div class="editor-field">
@(Html.Kendo().DropDownListFor(m => m.ReportType)
.Name("ReportType")
.DataTextField("Text")
.DataValueField("Value")
.OptionLabel("Select a Report Type...")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetFilteredTeams", "Home").Data("get_Dates");
}).ServerFiltering(true);
})
.HtmlAttributes(new { @class = "reportTypeDropdown" }))
</div>
When I inspect this page, I see that this JavaScript was generated:
kendo.SyncReady(function(){jQuery("#ReportType").kendoDropDownList({dataSource":{"transport":{"read":{"url":"/Reporting/Home/GetFilteredTeams","data":getDates},"prefix":""},"serverFiltering":true,"filter":[],"schema":{"errors":"Errors"}},"dataTextField":"Test","dataValueField":"Value","optionLabel":"Select a Report type..."});});
Again, I copied the DropDownList over to the preference page, where it's inside a PanelBar, made appropriate changes, and this is what it looks like: (FWIW, the get_Dates JavaScript function is in a separate JavaScript file associated with the preferences page. Also, the DropDownList is not bound to the model here).
<div class="pref-sub-section-item">
@(Html.Kendo().DropDownList
.Name("ReportTypePref")
.DataTextField("Text")
.DataValueField("Value")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetFilteredTeams", "Preferences").Data("get_Dates");
}).ServerFiltering(true);
})
.HtmlAttributes(new { @class = "reportTypeDropdown" }))
</div>
However, this is the JavaScript that gets generated:
kendo.SyncReady(function(){jQuery("#ReportTypePref").kendoDropDownList({"dataTextField":"Test","dataValueField":"Value"});});
Hi,
I wonder if you could help. I have a Kendo UI grid that has 2 bool elements, this is a MVC core 3.1 project. When I click on the Create or Update buttons on the Edit popup, nothing happens - no errors and the controller action is not being called.
I have code similar to the following code for the grid itself :
@(Html.Kendo().Grid<MyObject>()
.Name("MyGrid")
.DataSource(dataSource => dataSource
.Ajax()
.Model(m => m.Id(e => e.Id))
.PageSize(20)
.Read(read => read.Action("Read", "ActionRead"))
.Create(create => create.Action("Create", "ActionCreate"))
.Update(update => update.Action("Update", "ActionUpdate"))
.Events(events => events.Error("onError"))
)
.Columns(columns =>
{
columns.Bound(p => p.Name);
columns.Bound(p => p.IsCompleteStatus).ClientTemplate("<input type='checkbox' #= IsCompleteStatus ? checked='checked' :'' # />");
columns.Bound(p => p.IsPendingStatus);
columns.Command(command =>
{
command.Edit();
command.Custom("Remove").Click("onRemove").Visible("isRemoveable").IconClass("k-icon k-i-delete k-icon-32");
command.Custom("Restore").Click("onRestore").Visible("isRestorable").IconClass("k-icon k-i-reset k-icon-32");
});
})
.ToolBar(toolbar => toolbar.Create().Text("Add Status"))
.Editable(editable => editable.Mode(GridEditMode.PopUp))
.GridDefaults()
And this is what I have in my view for the popup window:
<form>
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<input asp-for="Id" type="hidden" />
@Html.FormGroupFor(m => m.Name)
@Html.EditorFor(m => m.IsCompleteStatus)
@Html.FormGroupFor(m => m.IsPendingStatus)
</form>
The popup displays fine. However clicking on the Create button (when I hit 'Add') or the Update button (when I click on 'Edit') does absolutely nothing, unless I actually check the checkbox.
If it is a bool type, it also doesn't let me leave it empty, so it needs it checked all the time.
If it a bool? type, it doesn't let me interact with it at all - I cannot check the boxes, so no Create/Update either. If I remove the checkboxes from the view, it displays and works fine. Can you help please? Thank you
Hi Team,
I am using Kendo UI MVC Grid and trying to override the checkbox style using FontAwesome fonts. I thought of doing it through CSS alone but since we can't select parent selector through CSS I ended up using the filterMenuInit event.
Grid column is configured using:-
.Filterable(f => f.Multi(true).Search(true));
I am adding another label to the rendered checkbox text using the below function:-
function addCustomLabel(e) {
var container = e.container;
var allCheckboxes = $("input[type='checkbox']", container);
$.each(allCheckboxes, function (id) {
$(this).attr("id", 'chk' + id).addClass("blueCheckbox");
var checkbox = $(this)[0];
console.log(checkbox);
var parentLabel = $(this).parent('label');
var labelText = parentLabel.text();
parentLabel.empty();
parentLabel.append(checkbox);
parentLabel.append("<label for='"+ 'chk' + id +"'>" + labelText + "</label>");
});
}