...
@(Html.Kendo().Grid<MyProject.Models.FileDetail>()
...
.Editable(editable =>
{
editable.Mode(GridEditMode.PopUp);
editable.TemplateName("template");
editable.Window(w => w.Title("file upload").Name("UploadWindow"));
})
.....
/*template.cshtml */
@model MyProject.Models.FileDetail
<div style="width: 400px">
<div>Title:</div>
<div>@Html.EditorFor(m => m.Title)</div>
@(Html.Kendo().Upload()
.Name("files")
.Events(e => e
.Success(@<text>
function() {
$(".k-grid-update").trigger('click');
}
</text>)
)
.Async(a => a.Save("Save", "Upload").Remove("Remove", "Upload").AutoUpload(false)
))
</div>
<!DOCTYPE html>
<
html
>
<
head
>
<
title
></
title
>
<
meta
charset
=
"utf-8"
/>
<
link
href
=
"kendo/styles/kendo.mobile.all.min.css"
rel
=
"stylesheet"
/>
<
link
href
=
"styles/main.css"
rel
=
"stylesheet"
/>
<!-- Scripts -->
<
script
src
=
"cordova.js"
></
script
>
<
script
src
=
"kendo/js/jquery.min.js"
></
script
>
<
script
src
=
"kendo/js/kendo.mobile.min.js"
></
script
>
<
script
src
=
"scripts/hello-world.js"
></
script
>
</
head
>
<
body
>
<
div
data-role
=
"view"
data-title
=
"Home"
id
=
"mainPageView"
>
<
a
data-role
=
"button"
href
=
"MainMenu.html"
>Main Menu</
a
>
</
div
>
<
div
data-role
=
"layout"
data-id
=
"mainLayout"
>
<
div
data-role
=
"header"
>
<
div
data-role
=
"navbar"
>
<
span
data-role
=
"view-title"
></
span
>
</
div
>
</
div
>
<
div
data-role
=
"footer"
>
</
div
>
</
div
>
<
script
>
var app = new kendo.mobile.Application(document.body,{transition:"silde",layout:"mainLayout"});
</
script
>
</
body
>
</
html
>
<
div
data-role
=
"view"
data-title
=
"Main Menu"
id
=
"mainMenuView"
>
<
p
>Main Menu</
p
>
<
a
href
=
"index.html"
data-role
=
"button"
>Home</
a
>
</
div
>
I have my kendo.grid using the grideditmode.popup for creating and editing. My foreign key values show fine in the grid and also on an edit in the drop downs. But they won't add the actual values into the db. So I add a new row and pick the two items in the two drop downs and they remain null in the db. If I edit one where they are null, they stay null. If I edit one where they aren't null and change the values, that works fine. Any ideas are appreciated.
columns.ForeignKey(item => item.InstructorID, (IEnumerable<
PointsInfrastructure.Instructor
>)ViewData["instructorList"], "InstructorID", "Name");
columns.ForeignKey(item => item.SchoolID, (IEnumerable<
PointsInfrastructure.School
>)ViewData["schoolList"], "SchoolID", "Name");
[Display(Name = "Instructor")]
[UIHint("GridForeignKey")]
public long? InstructorID { get; set; }
[Display(Name = "School")]
[UIHint("GridForeignKey")]
public long? SchoolID { get; set; }
// create new tournament
var listValue = new Competitor()
{
MemberID = inViewModel.MemberID,
LastName = inViewModel.LastName,
FirstName = inViewModel.FirstName,
MemberNumber = inViewModel.MemberNumber,
DateOfBirth = inViewModel.DateOfBirth,
InstructorID = inViewModel.InstructorID,
SchoolID = inViewModel.SchoolID,
Email = inViewModel.Email,
Sex = inViewModel.Sex,
Notes = inViewModel.Notes
};
_db.Competitors.Add(listValue);
_db.SaveChanges();