InvalidOprationException was unhandled by user
Error due to Sequence Contains no matching element
Kindly Help me out
6 Answers, 1 is accepted
This is a generic .NET exception which occurs when the Find or Single extension methods are used but no result (or more than one result) is returned. This stackoverflow question explains it in more detail.
Probably the data to which you are binding the component has changed and makes the code break. Can you isolate the exception in a sample project? A full stacktrace would also be of help.
Regards,
the Telerik team
<%: Html.Telerik().Menu() _
.Name("menu") _
.Orientation(MenuOrientation.Horizontal) _
.Items(Sub(menu)
menu.Add().Text("Home").Action("Index", "Home").HtmlAttributes(New With {.style = "font-size: 8pt;"})
menu.Add().Text("eMASON").Items(Sub(subitem)
subitem.Add().Text("About").Url("http://www.emason.biz/content/company/history.aspx").HtmlAttributes(New With {.style = "font-size: 8pt;"}).LinkHtmlAttributes(New With {.target = "_blank"})
subitem.Add().Text("Clarifire").Url("http://www.emason.biz/content/clarifire/index.aspx").HtmlAttributes(New With {.style = "font-size: 8pt;"}).LinkHtmlAttributes(New With {.target = "_blank"})
subitem.Add().Text("Contact Us").Url("http://www.emason.biz/content/contact/index.aspx").HtmlAttributes(New With {.style = "font-size: 8pt;"}).LinkHtmlAttributes(New With {.target = "_blank"})
End Sub)
menu.Add().Text("HUD").HtmlAttributes(New With {.style = "font-size: 8pt;"}).Items(Sub(subitem)
subitem.Add().Text("About").Url("http://portal.hud.gov/hudportal/HUD?src=/about").HtmlAttributes(New With {.style = "font-size: 8pt;"}).LinkHtmlAttributes(New With {.target = "_blank"})
subitem.Add().Text("Contact Us").Url("http://portal.hud.gov/hudportal/HUD?src=/contact").HtmlAttributes(New With {.style = "font-size: 8pt;"}).LinkHtmlAttributes(New With {.target = "_blank"})
End Sub)
menu.Add().Text("US Department of Treasury").HtmlAttributes(New With {.style = "font-size: 8pt;"}).Items(Sub(subitem)
subitem.Add().Text("About").Url("http://www.treasury.gov/about/Pages/default.aspx").HtmlAttributes(New With {.style = "font-size: 8pt;"}).LinkHtmlAttributes(New With {.target = "_blank"})
subitem.Add().Text("Contact Us").Url("http://www.treasury.gov/about/Pages/default.aspx").HtmlAttributes(New With {.style = "font-size: 8pt;"}).LinkHtmlAttributes(New With {.target = "_blank"})
End Sub)
menu.Add().Text("Contact Us").HtmlAttributes(New With {.style = "font-size: 8pt;"}).Items(Sub(subitem)
subitem.Add().Text("About").Action("About", "Home").HtmlAttributes(New With {.style = "font-size: 8pt;"})
subitem.Add().Text("Tech Support").Action("TechSupport", "Support").HtmlAttributes(New With {.style = "font-size: 8pt;"})
subitem.Add().Text("Site Feedback").Action("Feedback", "Support").HtmlAttributes(New With {.style = "font-size: 8pt;"})
End Sub)
End Sub)
%>
This exact code works as expected with the current official release. Find attached my test project.
All the best,Atanas Korchev
the Telerik team
So that tells me that there's no problem with the menu at all, it's just a side effect.
Thanks
This is very strange indeed. Could you somehow reproduce it in the attached project? We would really like to see what is causing this exception and avoid it somehow. Perhaps the stacktrace which ends to the Menu code would indicate the cause of the exception.
Regards,Atanas Korchev
the Telerik team