Issue in using Kendo Grid Column Template in .Net Core, works fine in .net mvc
#(Html.Kendo().Grid<Model>().Method()
.Columns(c => {
c.Template(m => null).Title("").Width(10)
.ClientTemplate();
})
Error in m => null: Cannot convert lambda expression to type string because it is not a delegate type
Please help
Related
I have a project which uses Telerik Kendo.
In the Kendo Grid, we need to make the first row editable so the user can type inside it to use it to search the data. Actually, the Kendo grid provides this functionality when you click on the header of the of the grid, but my requirement is to provide this functionality.
I searched the web for hours, without reaching any Result.
I do not think I need to provide any code here, because I really do not know the way to go.
The project is ASP.NET MVC, and I am using Telerik MVC wrapper.
I used the row-filter feature which provided by Telerik, and it was good for me.
but I have small problem.
here it is what I used,
function templateMethod (args) {
args.element.kendoDropDownList({
dataSource: args.dataSource,
dataTextField: "color",
dataValueField: "color",
valuePrimitive: true
});
}
The previous example is from documentation of the Telerik from here
Keep in mind that the passed dataSource instance may still not be populated at the time the template function is called, if the Grid uses remote binding.
I am really using remote binding, and the data is NOT coming ,as the documentation state, the problem is that the documentation warned from this problem but it did not provide any solution for it.
How can I repupolate the kendoDropDownList again, after the data is coming from the remote server?
#(Html.Kendo().Grid<SomeClassName>()
.BTGrid(GridName)
.Resizable(e => e.Columns(true))
.Filterable(e => e.Mode(GridFilterMode.Row))
.Columns(columns =>
{
columns.Bound(x => x.VardiyaGrubu).Filterable(e => e.Cell(r => r.Template("templateMethod").ShowOperators(false).Operator("contains").SuggestionOperator(FilterType.Contains) ));
})
.Groupable(config => config.Enabled(true))
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(true)
.Model(x => x.Id(r => r.RefKey))
.Events(ev => ev.RequestEnd("onRequestEnd"))
.Read(read => read.Action("CevrimZamaniRaporu", "Raporlar").Data(GridName + "_LoadData"))))
I tried to set ServerOperation to true and false in both cases it does not change.
I am getting the error:
Delegate 'System.Action' does not take 1 arguments
While creating a Splitter with Partial view rendered inside one of the panes of Splitter. The error is at Content property of the the pane. Please suggest me any changes to solve the problem
#(Html.Kendo().Splitter()
.Name("vertical")
.HtmlAttributes(new { style = "height:900px" })
.Orientation(SplitterOrientation.Horizontal)
.Panes(panes =>
{
panes.Add()
.HtmlAttributes(new { id = "pane1" })
.Resizable(true)
.Size("300px")
.Collapsible(false)
.Content((#<text><div>#Html.RenderPartial("GetUsers", Model)</div></text>));
})
)
with the information from the following link I am able solve my problem. When you have to nest container controls of kendo UI you need to create a helper method for nested content and call the helper method as cotent for container control.
Kendo widgets two level deep in Razor, inline markup blocks cannot be nested
I am using slickgrid in my applications, but lately I was facing some bugs and weird behavior in slickgrid(specially related to grouping). There are lots of public and private repositories and not sure which is good.
I was thinking of using kendoui. But have below questions in mind -
1) Can kendoui provide better performance than slickgrid when UI have huge data say 50k records?
2) Do kendoui grid have same features as slickgrid have? Mostly excel style feature like automatically populating value for columns when you drag over rows.
Thanks in advance.
Use of Slick grid can be complicated as it should be done on javascript. So the drawback of this grid is that this grid needs to be filled on document ready if we want to display it in View in MVC. Advantage of using this grid is that it is free.
On other hand, using kendo grid gives flexibility for the user to use it on View itself(as shown below). So therefore this grid runs faster as compared to Slick grid. KendoUI is a Paid UI.
//Controller
List<Student> Studentlist = new List<Student>();
FillStudentsObject(Studentlist);
return View(Studentlist);
//View
#using Kendo.Mvc.UI;
#using KendoGridWork.Models;
#model List<Student>
#(Html.Kendo().Grid(Model).Name("StudentModel")
.Columns(column =>
{
column.Bound(p => p.ID).Width(30).EditorTemplateName("#=GetID(this)#");
column.Bound(p => p.First_Name).Width(100);
column.Bound(p => p.Last_Name).Width(100);
column.Bound(p => p.Division).Width(30);
column.Bound(p => p.Standard).Width(30);
column.Bound(p => p.Percentage).Width(50);
})
.Selectable()
.Sortable()
.Editable(editable => editable.Mode(GridEditMode.InCell).DisplayDeleteConfirmation(false)).Navigatable()
.Filterable()
.DataSource(datasource=>datasource
.Ajax()
.ServerOperation(false)
.Model(model =>
{
model.Id(p => p.ID);
model.Field(p => p.ID).Editable(false);
}))
)
KendoUI & slickgrid
For mine opinion Kendo UI would be better. because of Web Accessibility, simply put, is the creation of sites and applications that can be fully experienced by the broadest number of users. That includes disabled users, who typically visit the sites we create with the help of assertive technologies, like a screen reader. go ahead for Kendo UI
I am using Kendo grid with pop up editing mode and editor template.
The editor template consists of a kendo drop down list which is bind through the database and i have inserted the optional label value ie "--select--" at run time in controller which works good for add method but for update method it is not autoselecting the "--select value--" and on click value is selected at second hit. Please help if anyone has any solution to this.
Edited: Please find the below code snippet for my drop down list.
#(Html.Kendo().DropDownList().Name("Type")
.DataTextField("Value")
.DataValueField("TypeID")
.DataSource(source =>
{
source.Read(read => { read.Action("Action Name", "Controller name"); });
})
)
// Controller code for binding drop down list
[AllowAnonymous]
public ActionResult GetTypes()
{
//my code to get list of types from db in object "Type"
Type.Insert(0, new TypeModel() { Value = "--Select--", TypeID = Guid.Empty });
return Json(Type, JsonRequestBehavior.AllowGet);
}
As you said in comment section, Kendo UI 2015 Q1 comes with some new features for dropdown family widget e.g autocomplete, dropdown, multiselect, etc and it also has some bug on it.
So its not your fault that the dropdown won't recognize on the first select event.
The developer had fixed this issue and release a service pack for this, therefore all you have to do is upgrade or downgrade your Kendo UI version..
See this dojo where the grid's filter doesn't work for the first time selection
and if you downgrade its version or upgrade it, it will works fine like in this dojo
Kendo UI 2015 Q1 SP1 Release History, you will see on DropDown section that the issue have been fixed..
i have used kendo scheduler like this
#(Html.Kendo().Scheduler<myEntity>()
.Name("scheduler")
.Date(currentDateTime)
//.Events(e => { e.Error("error_handler"); })
);
now i want to retrieve the same instance and add another property to it say Events
as in
.Events(e => { e.Error("error_handler"); })
dynamically. how can i do this
You can do it in JavaScript (only):
var scheduler = $("#scheduler").data('kendoScheduler');
scheduler.bind("error", error_handler);
If you wanna set not event property you should find correct method to do it in kendo documentation and api reference
There is also .setOptons('name', value) method in most of kendo components but unfortunately it usually just change value of property and does not render comonent again with new options.