I am trying something simple, or what should be simple. Creating a Kendo MVC Grid, and populating it via Ajax. Before you suggest it, I have looked in the developer tools in Chrome, and there are no Javascript errors whatsoever. No exceptions in the code, and no javascript errors. It will most likely be something simple, but I just cannot seem to find it.
I have placed a breakpoint in the action in which it should be calling, and it never, ever even calls it. If it at least called it, I'd know where to start looking, but it never calls it. And again, no javascript errors whatsoever, as shown in the attached screen capture.
My cshtml page:
@{
ViewBag.Title =
"Index"
;
}
<h2>Index</h2>
@(Html.Kendo().Grid<User>()
.AutoBind(
true
)
.Name(
"userGrid"
)
.Columns(cols => {
cols.Bound(c => c.UserId);
cols.Bound(c => c.FirstName);
cols.Bound(c => c.LastName);
cols.Bound(c => c.UserName);
})
.Scrollable()
.Sortable()
.Pageable(pageable => pageable
.Refresh(
true
)
.PageSizes(
true
)
.ButtonCount(5))
.DataSource(ds => ds
.Ajax()
.Read(r => r.Action(
"AllUsers"
,
"Home"
).Type(HttpVerbs.Get))
.PageSize(20))
)
My Controller is also just as simple:
using
System.Collections.Generic;
using
System.Web.Mvc;
using
Kendo.Mvc.Extensions;
using
Kendo.Mvc.UI;
using
TelerikMVC_Template.Models;
using
TelerikMVC_Template.Repository;
namespace
TelerikMVC_Template.Controllers
{
[Authorize]
public
class
HomeController : Controller
{
private
readonly
IUserRepository userRepository =
new
UserRepository(
new
VUsersContext());
// GET: Home
public
ActionResult Index()
{
return
View();
}
[HttpGet]
[ActionName(
"AllUsers"
)]
public
JsonResult AllUsers([DataSourceRequest]DataSourceRequest request)
{
IEnumerable<User> theseUsers = userRepository.SelectAll();
return
Json(theseUsers.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
}
}
And finally my User class definition:
public
class
User
{
public
System.Guid UserId {
get
;
set
; }
public
string
UserName {
get
;
set
; }
public
string
Email {
get
;
set
; }
public
string
FirstName {
get
;
set
; }
public
string
LastName {
get
;
set
; }
public
string
Comment {
get
;
set
; }
public
string
Password {
get
;
set
; }
public
System.DateTime LastLoginDate {
get
;
set
; }
public
System.DateTime LastPasswordChangedDate {
get
;
set
; }
public
System.DateTime CreationDate {
get
;
set
; }
public
bool
IsLockedOut {
get
;
set
; }
public
bool
IsActive {
get
;
set
; }
public
int
FailedPasswordAttemptCount {
get
;
set
; }
public
System.DateTime? LastPasswordFailedDate {
get
;
set
; }
public
System.DateTime CreatedDate {
get
;
set
; }
}
I understand how to pass additional data as a parameter example I am doing this
.Read(read => read.Action("GetOpenInvoices", "Maint", new { cust = Request.QueryString["cust"] }))
Is it possible to have Parent/child or grid/details grid to do without entity framework meaning asking custom stored procedures for the data?
I have a grid with Invoices. I want user to select multiple checkboxes and then click the button and based on that 2nd grid gets populated.
or have a parent grid loaded and based on checkboxes (invoice# which is a string) I click ask stored procedure to get me corresponding comments.
Initially 2nd grid is empty.
If you have any example that will be great.
I want an example without entity framework.
Please reply if there is any easy solution.
Thank you,
Gaurav
Does Telerik have the ability to generate a IMB(OneCode) bar code?
I ask since I saw an option for the POSTNET barcode which was retired from the USPS in 2013.
Please advise.
I have a custom popup editor that's used as the editor in a parent grid and in the nested grid of another parent grid:
Grid 1 -> Shared Custom Popup
Grid 2 >Tabstrip > Nested Grid -> Shared Custom Popup
In the popup editor, I have a field "created_date" that I need to display as a string instead of an editor box. I know that for popup editors of a parent grid, I need to use this syntax:
${kendo.toString(created_date,
"MM/dd/yyyy hh:mm tt"
)}
And for popup editors of a nested grid, I need to use this syntax:
#= kendo.toString((created_date), "MM/dd/yyyy hh:mm tt") #
The syntax for popup editors of a parent grid won't work for the popup editors of a nested grid and vice versa.
How would I display a string for a field in a popup editor that's shared between a parent grid and the nested grid of another parent grid?
I have a simple Kendo UI grid setup for serverside processing which displays some employee information. The grid displays just fine when i first load the view but as soon as you click on a column to sort it refreshes and just gives me an empty grid. The Action is firing each time a column header is click and is returning the correct amount of records to the view. See my code below:
View:
@ModelType List(Of ConnectEntities.Employee)
@Code
ViewData("Title") = "CompanyDirectory"
Layout = "~/Views/Shared/_HomeLayout.vbhtml"
End Code
<
div
class
=
"row"
>
<
div
class
=
"col-md-12"
>
<
div
class
=
"panel panel-primary"
>
<
div
class
=
"panel-heading"
>
<
h4
>Company Directory</
h4
>
</
div
>
<
div
class
=
"panel-body"
>
@Code
Html.Kendo.Grid(Of ConnectEntities.Employee)() _
.Name("employeeDirectory") _
.BindTo(DirectCast(ViewData("employees"), IEnumerable(Of ConnectEntities.Employee))) _
.Columns(Sub(c)
c.Bound(Function(p) p.FirstName_AD).Sortable(True)
c.Bound(Function(p) p.LastName_AD)
c.Bound(Function(p) p.JobTitle_AD)
c.Bound(Function(p) p.PhoneNumber_AD)
End Sub) _
.DataSource(Sub(d)
d.Server() _
.Read(Function(read) read.Action("Person_Read", "Home"))
End Sub) _
.Sortable() _
.Filterable() _
.Render()
End Code
</
div
>
</
div
>
</
div
>
</
div
>
Controller Code:
Function
CompanyDirectory()
As
ActionResult
Dim
employees
As
List(Of ConnectEntities.Employee)
Using connectDB
As
New
ConnectEntities.ConnectEntities
employees = connectDB.Employees.ToList
End
Using
ViewData(
"employees"
) = employees
Return
View()
End
Function
Public
Function
Person_Read()
As
ActionResult
Dim
employees
As
List(Of ConnectEntities.Employee)
Using connectDB
As
New
ConnectEntities.ConnectEntities
employees = connectDB.Employees.ToList
End
Using
Return
View(
"CompanyDirectory"
, employees)
End
Function
Hi,
The grid column headers split the view model property names when there is an uppercase character in the viemodel property name. That is good. But when I have an non-English character in the name the column header will also be split. Is this the intended behaviour? I know I can workaround the issue by using DisplayName in the model or .Title() in the grid, but that is a lot of unnecessary work.
ViewModel:
public class AvslagnaIndexViewModel
{
public Guid Id { get; set; }
public string DiarieNummerSSM { get; set; }
public DateTime AnsökningsDatum { get; set; }
public string Handläggare { get; set; }
public string ExportörNamn { get; set; }
public string SlutanvändareNamn { get; set; }
public string BestämmelseLandNamn { get; set; }
public string Status { get; set; }
}
Grid columns:
.Columns(columns =>
{
columns.Bound(p => p.Id).Hidden().Title("Id");
columns.Bound(p => p.DiarieNummerSSM).ClientTemplate(
Html.ActionLink("#=DiarieNummerSSM#", "Details", "Avslagna", new { id = "#=Id#" }, new { title = "Visa ärendedetaljer", @class = "k-link k-grid-edit-row" }).ToHtmlString()).Width(120);
columns.Bound(p => p.AnsökningsDatum).Format("{0:yyyy-MM-dd}");
columns.Bound(p => p.Handläggare);
columns.Bound(p => p.ExportörNamn);
columns.Bound(p => p.SlutanvändareNamn);
columns.Bound(p => p.BestämmelseLandNamn);
columns.Bound(p => p.Status);
})
See the attached image for the result. All words containing non-English caracters are split in more places than they should be. As you can see "BestämmelseLandNamn" is shown as "Bestä mmelse Land Namn"
Best regards,
Henrik
I am trying to open a kendo window based on input from a form. I am getting this error:
JavaScript runtime error: Object doesn't support property or method 'open'
The error occurs when win.open(); is called in the JavaScript in the view as listed below. Any help would be great.
Here is my controller:
using Kendo.Mvc.UI;
using Kendo.Mvc.Extensions;
using KendoGridAjaxBinding.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace KendoGridAjaxBinding.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
TheModel m = new TheModel();
return View(m);
}
public ActionResult Search( TheModel m)
{
if (m.Name != string.Empty)
{
ViewData["OpenGrid"] = "OpenGrid";
}
return View("Index", m);
}
}
}
Here is my view:
@using System
@using System.Web
@using System.Web.Mvc
@using System.Web.Razor
@using Kendo.Mvc.UI
@using KendoGridAjaxBinding.Models
@model TheModel
@using (Html.BeginForm("Search", "Home", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
<
label
for
=
"textinput"
>Name</
label
>@Html.TextBoxFor(model => model.Name, new { @class = "input-xs form-control", placeholder = "Name", type = "text" })<
br
/>
<
label
for
=
"textinput"
>Address</
label
>@Html.TextBoxFor(model => model.Address, new { @class = "input-xs form-control", placeholder = "Address", type = "text" })<
br
/>
<
label
for
=
"textinput"
>City</
label
>@Html.TextBoxFor(model => model.City, new { @class = "input-xs form-control", placeholder = "City", type = "text" })<
br
/>
<
label
for
=
"textinput"
>State</
label
>@Html.TextBoxFor(model => model.State, new { @class = "input-xs form-control", placeholder = "State", type = "text" })<
br
/>
<
button
id
=
"Search"
class
=
"btn btn-primary"
>Search</
button
>
}
@(Html.Kendo().Window()
.Name("window")
.Width(630)
.Height(315)
.Draggable()
.Resizable()
.Title("Test Test Test")
.Actions(actions => actions.Pin().Refresh().Maximize().Close())
.Visible(false)
)
<
script
type
=
"text/javascript"
>
var messageX = '@ViewData["OpenGrid"]';
if (messageX = "OpenGrid")
{
$("#window").kendoWindow();
var win = $("#window").data("kendoWindow");
var win = $("#window")
if (win != null)
{
win.open();
}
}
</
script
>
The Model:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace KendoGridAjaxBinding.Models
{
public class TheModel
{
public string Name { get; set; }
public string Address { get; set; }
public string City { get; set; }
public string State { get; set; }
}
}
Thanks in advance,
rstinson
When do you have a working release?
The nuget package 2016.2.607 does not install.
When do we have a version for payed customer without demo message.
When will the documentation for RC2 be updated?
I know it is a RC but as you advertise and blog about it as if it works I am a little suprised that the quality is so bad.