my application is an asp.net MVC; I am using Telerik MVC Tree view to display nodes from a model, it works well, except when a value of one node is null.
here is my TreeView:
<% IEnumerable<MyTreeNode> tree = ViewBag.TreeData.Nodes; %>
<%= Html.Telerik().TreeView().Name("TreeView").BindTo(tree, mappings =>
{
mappings.For<MyTreeNode>(binding => binding.ItemDataBound((item, myTreeNode) => {
item.Text = myTreeNode.Text; })
.Children(myTreeNode => myTreeNode.Nodes));
})
.ClientEvents(events => events.OnSelect("onSelect")) %>
I get the following error (pointing to myTreeNode.Text) “value” cannot be null or empty.
I tried:
if (!IsNullOrEmpty(item.Text))
{
item.Text = myTreeNode.Text;
}
I get this error: The name ‘IsNullOrEmpty’ does not exist in the current context.
Any suggestions, thanks in advance.
IsNullOrEmpty() is a static method call on a string class.