This question is locked. New answers and comments are not allowed.
hi all
I changed my model for a treeview to use an IEnumerable list of Course ( bascially am emulating the MVC treeview DEMO for model binding with treeview ) I get the error that the Sequence contains no elements
Prior to this I was just passing in the model (complex) and it worked fine with the exception that the textValue was not b
eing populated with the appropriated ID (course ID or section ID etc) ...Without the ID , I can't edit or Delete so I have to have the ID......All googling has let me to believe that there could be an issue with LINQ find a null mapping ....as the some lessons may not have sections..... Should I or can I specifiy where the Child of the Unit is Not NULL....would that fix this situation??? .Children(unit => unit.Lessons)
thanks in Advance...you guys are great resource...
I changed my model for a treeview to use an IEnumerable list of Course ( bascially am emulating the MVC treeview DEMO for model binding with treeview ) I get the error that the Sequence contains no elements
System.Web.Mvc.ViewPage<IEnumerable<XP.Models.CustomClasses.Course>>
<%
= Html.Telerik().TreeView().Name("TreeView")
.ClientEvents(events => events
.OnNodeDragStart(
"onNodeDragStart")
.OnNodeDragCancelled(
"onNodeDragCancelled")
.OnNodeDragging(
"onNodeDragging")
.OnNodeDrop(
"onNodeDrop")
.OnNodeDropped(
"onNodeDropped")
)
.DragAndDrop(
true)
.DragAndDrop(settings => settings
.DropTargets(
".drop-container")
)
.BindTo(Model, mappings => |
{ |
mappings.For<XP.Models.CustomClasses.Unit>(binding => binding |
.ItemDataBound((item, unit) => |
{ |
item.Text = unit.Title; |
item.Value = unit.Id.ToString(); |
item.ImageUrl = "../../Images/unit32.png"; |
}) |
); |
mappings.For<XP.Models.CustomClasses.Lesson>(binding => binding |
.ItemDataBound((item, lesson) => |
{ |
item.Text = lesson.Title; |
item.Value = lesson.Id.ToString(); |
item.ImageUrl = "../../Images/lesson32.png"; |
}) |
); |
mappings.For<XP.Models.CustomClasses.Section>(binding => binding |
.ItemDataBound((item, section) => |
{ |
item.Text = section.Title; |
item.Value = section.Id.ToString(); |
item.ImageUrl = "../../Images/section32.png"; |
}) |
); |
}).HtmlAttributes(new { @class = "t-group" }) |
jQuery(
'#TreeView').tTreeView({ onLoad: onLoad, dragAndDrop: { "dropTargets": ".drop-container" }, onNodeDrop: onNodeDrop, onSelect: onSelect, onNodeDropped: onNodeDropped });
Prior to this I was just passing in the model (complex) and it worked fine with the exception that the textValue was not b
eing populated with the appropriated ID (course ID or section ID etc) ...Without the ID , I can't edit or Delete so I have to have the ID......All googling has let me to believe that there could be an issue with LINQ find a null mapping ....as the some lessons may not have sections..... Should I or can I specifiy where the Child of the Unit is Not NULL....would that fix this situation??? .Children(unit => unit.Lessons)
thanks in Advance...you guys are great resource...
Craig T
BTW: error is on this line
System.InvalidOperationException: Sequence contains no elements
Line 182: <%= Html.Telerik().TreeView().Name("TreeView")