Hi
I'm having trouble binding my grid to my Web API, the grid is always empty. Is there something I may have missed.
My Web API returns the following JSON:
{
"Contacts"
:[{
"Id"
:1,
"Salutation"
:
"Mr"
,
"FirstName"
:
"David"
,
"LastName"
:
""
,
"Address1"
:
"10 High Street"
,
"City"
:
"Birmingham"
,
"Postcode"
:
"B76 1FP"
},{
"Id"
:2,
"Salutation"
:
"Mr"
,
"FirstName"
:
"Fred"
,
"LastName"
:
"Bloggs"
,
"Address1"
:
"5 Birmingham Road"
,
"City"
:
"Solihull"
,
"Postcode"
:
"B26 1EW"
}]}
I have a Kendo Grid setup like this:
$(
"#grid"
).kendoGrid({
dataSource: {
transport: {
read: {
dataType:
"json"
,
url:
"http://localhost:54604/api/Contacts"
}
},
pageSize: 20,
schema: {
model: {
id:
"Id"
,
fields: {
Id: { type:
"number"
},
Salutation: { type:
"string"
},
FirstName: { type:
"string"
},
LastName: { type:
"string"
},
Address1: { type:
"string"
},
City: { type:
"string"
},
Postcode: { type:
"string"
}
}
},
data:
"Contacts"
}
},
height: 550,
filterable:
true
,
sortable:
true
,
pageable:
true
,
columns: [
{
field:
"Salutation"
},
{
field:
"FirstName"
,
title:
"First Name"
},
{
field:
"LastName"
,
title:
"Last Name"
},
{
field:
"Address1"
,
title:
"Address 1"
},
{
field:
"City"
},
{
field:
"Postcode"
}
]
});
I have two responsive panels in the page which then collapse into two "hamburger" menus. The problem that I have is when I click on one "hamburger" menu both of them expand. How do you go about expanding each "hamburger" menu separately?
For background, I have created a default website and added a page with the same code as found at this link.
https://demos.telerik.com/aspnet-mvc/responsive-panel
The first "hamburger" menu is the default menu items of a web site and the second "hamburger" menu is generated by the code used from the above link.
I have also uploaded a screenshot for reference. What am I missing?
Thank you,
Ricky
Hi,
I want to use server side paging for grid in my project. I was unable to achieve that. Could you provide any working sample of code. Below is my code.
@{Html.Kendo().Grid<ViewModels.GridModel>()
.Name("grdTasks")
.Columns(columns =>
{
columns.Bound(o => o.ActionItemId)
.Hidden(true);
columns.Bound(o => o.StudyNo)
.Title(@Html.GetResourceValue("DashboardWidget.TaskTracking", "AI_UI_Label_ActionItemStudy")
.ToHtmlString())
.Width(75)
.HtmlAttributes(new { @class = "gridRowLeftAligned", style = "color:black;" })
.HeaderHtmlAttributes(new { @class = "gridHeaderRow", style = "border:none; font-family:Arial text-align:left;font-size: 12px; " })
.Filterable(false)
.Sortable(true);
columns.Bound(o => o.SiteName)
.Title(@Html.GetResourceValue("DashboardWidget.TaskTracking", "AI_UI_Label_ActionItemSite")
.ToHtmlString())
.Width(95)
.HtmlAttributes(new { @class = "gridRowLeftAligned" ,style = "color:black;" })
.HeaderHtmlAttributes(new { @class = "gridHeaderRow", style = "border:none;font-family:Arial;text-align:left;font-size: 12px; " })
.Filterable(false)
.Sortable(true);
columns.Bound(o => o.AssignedToName)
.Title(@Html.GetResourceValue("DashboardWidget.TaskTracking", "AI_UI_Label_ActionItemAssignedto")
.ToHtmlString())
.Width(85)
.HtmlAttributes(new { @class = "gridRowLeftAligned", style = "color:black;" })
.HeaderHtmlAttributes(new { @class = "gridHeaderRow", style = "border:none; font-family:Arial;text-align:left;font-size: 12px; " })
.Filterable(false)
.Sortable(true);
})
.NoRecords(@<text>Loading...</text>)
.DataSource(dataSource => dataSource.Ajax()
.Read(read => read.Action("GrdActionListAjaxBindingKendo", "ActionItem", new { filterKey = (string)ViewData["filterKey"] }))
.Model(model => model.Id(site => site.StudyId))
.PageSize((int)ViewData["pageSize"])
.Total((int)ViewData["totalRecords"])
.ServerOperation(true)
)
.EnableCustomBinding(true)
.Events(events=>events.DataBound("Tasks_OnDataBound"))
.Sortable()
.Scrollable()
.HtmlAttributes(new { style = "font-size:10px; font-weight:bold; font-family:Arial; width:100%;" })
.Pageable(page => page.Enabled(true).PageSizes(new Int32[] { 20, 30, 50, 100 }))
.Render();
Here datais binding properly only for the first time. But based on Total records grid has to display paging info. It is not doing that.
Could you help me.
Hi there,
I'm having difficulty in finding information on Binding a TabStrip to a datasource similar to the other controls and the JQuery version. Can you give me a practical example of binding it to a List<T>?
I am sure you are also still busy updating the documentation. Our architect has very colorful ways of creating his rest endpoints. Things are getting a bit sketchy when it comes to https://docs.telerik.com/aspnet-mvc/api//Kendo.Mvc.UI.Fluent/DataSourceBuilder#webapi .
Thanks for your help.
$("#clients-grid").data("kendoGrid").dataSource.read()
I was trying to display some report data using Kendo grid and I’m getting uncaught errors kendo.syncReady. is not a function. Is this a new function added in any recent version of KendoUI?
Regards
I have a large existing ASP.NET MVC project where I want to introduce Telerik gradually. I have separate layout files for pages that should use Telerik and pages that do not. Some fields that do not use the Telerik included layout page are still getting the kendo styling.
Example:
I have a login page. Password field should use bootstrap styling.
@Html.EditorFor(model => model.Password,
new
{ htmlAttributes =
new
{ @
class
=
"form-control"
} })
Field settings from view model:
[DisplayName(
"Password"
)]
[DataType(DataType.Password)]
public
string
Password {
get
;
set
; }
When I load the page the field gets kendo styling. How do I prevent this?
<
input
class
=
"k-textbox"
id
=
"Password"
name
=
"Password"
type
=
"password"
value
=
""
/>