I have a simple class that has a class as one of it's properties. I am trying to use the grid to both display the properties and allow in-line editing. If I don't use default values and I try to edit I get "Microsoft JScript runtime error: Syntax error, unrecognized expression: [data-container-for=Person.PersonId].
If I do use default values I get "Cannot serialize objects of type Person" when I load the page.
Help would be greatly appreciated since I haven't been able to find any information.
-Kerry
Here's the code
class User
{
int UserId;
string LoginName;
Person person;
}
class Person
{
int PersonId;
string FirstName;
string LastName;
string Email;
}
<%
= Html.Kendo().Grid<UserDto>()
.Name("UserListGrid")
.DataSource(ds => ds.Ajax()
.Update(update => update.Action("AjaxSaveUser", "User"))
.Destroy(destroy => destroy.Action("AjaxDeleteUser", "User"))
.Create(create => create.Action("AjaxInsertUser", "User"))
.Read(read => read.Action("List", "User"))
.Model(model => model.Id(m => m.UserId))
.Model(model => model.Field(m => m.UserId).Editable(false))
.Events(e => e.Error("grid_OnError"))
)
.Columns(col =>
{
col.Bound(us => us.UserId).Title("ID");
col.Command(us => us.Edit());
col.Bound(us => us.LoginName).Title("Login");
col.Bound(us => us.Person.PersonId).Hidden();
col.Bound(us => us.Person.LastName).Title("Last Name");
col.Bound(us => us.Person.FirstName).Title("First Name");
col.Bound(us => us.Person.Email).Title("Email");
col.Command(us => us.Destroy());
})
.ToolBar(commands => commands.Create().Text("Add User"))
.Editable(edit => edit.Mode(GridEditMode.InLine))
%>