This question is locked. New answers and comments are not allowed.
I am having all kinds of weird issues when I try to set the content on my treeview item. Using this -
Here's the treeview:
child.Content = Function() %><ul><li><%Response.Write(reportType.taskInfo)</li></ul><% I get Multiline lambda expression is missing 'End Function'. If I add End Function, it gets really weird - the code gets pushed way out with part of it overwriting the End Function and I get the compilation warning Function '<anonymous method>' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used. And things just do not work very well. Since this is VB, should I be coding this differently? I am using VB.NET 10... Thank you in advance for your help.Here's the treeview:
<%= Html.Telerik().TreeView().Name("ReportGroups").ShowCheckBox(True).HtmlAttributes(New With {.style = "font-size:1em; height:550px;"}) _ .ClientEvents(Function(evt) evt.OnSelect("getReports")) _ .ClientEvents(Function(evt) evt.OnLoad("setContextMenu")) _ .ClientEvents(Function(evt) evt.OnDataBound("onTreeViewLoad")) _ .ClientEvents(Function(evt) evt.OnCollapse("updateTreeViewState")) _ .ClientEvents(Function(evt) evt.OnExpand("updateTreeViewState")) _ .BindTo(CType(Model.reportGroupNames, IEnumerable(Of ReportTreeModel)), Sub(mappings) mappings.For(Of ReportTreeModel)( Sub(binding) binding _ .ItemDataBound( Sub(item, rpt) Dim isExpanded As Boolean = DirectCast(ViewData("ReportExpandedNodes"), String()).Contains(rpt.reportGroupNameKey) If isExpanded Then item.Text = "<span class='expanded'></span>" + rpt.reportGroupName Else item.Text = rpt.reportGroupName End If item.Value = rpt.reportGroupNameKey item.Encoded = False item.LoadOnDemand = False End Sub) binding.Children(Function(rpt) rpt.reportUserGroups) End Sub) mappings.For(Of ReportUserGroupModel)( Sub(binding) binding _ .ItemDataBound( Sub(child, userGroup) child.Text = userGroup.userGroupName child.Value = userGroup.userGroupNameKey child.LoadOnDemand = False child.Encoded = False End Sub) binding.Children(Function(userGroup) userGroup.reportTypes) End Sub) mappings.For(Of UserGroupReportType)( Sub(binding) binding _ .ItemDataBound( Sub(child, reportType) child.Text = reportType.resourceType + " - " + reportType.fileType child.Value = reportType.webPermissionsKey child.Content = Function() %><ul><li><%Response.Write(reportType.taskInfo)%></li></ul><% End Sub) End Sub) End Sub)