How To go To - Click Event

I filled out the menus through a viewbag. Those are my controls.

 public class childItems
    {
        public string nodeId;
        public string nodeText;
        public string icon;
        public bool expanded;
        public bool selected;
        public string iconCss;
    }

public class Parentitem
    {
        public string nodeId;
        public string nodeText;
        public string icon;
        public bool expanded;
        public bool selected;
        public string iconCss;
        public List<childItems> child;
    }

// controller //

 List<childItems> childitem1 = new List<childItems>();
            parentitem.Add(new Parentitem
            {
                nodeId = "05",
                nodeText = "Atendimentos",
                iconCss = "icon-code icon",
                child = childitem1,
            });
            childitem1Add(new childItems { nodeId = "01-01", nodeText = "Menu1", iconCss = "icon-circle-thin icon" });   //  <====== How To go to Menu1 View ???
            childitem1.Add(new childItems { nodeId = "01-02", nodeText = "Menu2", iconCss = "icon-circle-thin icon" });  //  <====== How To go to Menu2 View ???
            childitem1.Add(new childItems { nodeId = "01-03", nodeText = "Menu3", iconCss = "icon-circle-thin icon" });  //  <====== How To go to Menu3 View ???



How do I add the click event so that the menu goes to another view?

1 Reply

SP Sowmiya Padmanaban Syncfusion Team May 13, 2020 01:08 PM UTC

Hi David,  
 
Greetings from Syncfusion support. 
 
We have checked your requirement with TreeView component. In TreeView component, we have provided a navigateUrl property. Using this property, you can navigate to the other page when clicking the TreeView node. Refer the below code snippet to declare the naviagteURL property. 
 
<ejs-treeview id="listdata"> 
                    <e-treeview-fields dataSource="ViewBag.dataSource" id="id" parentId="pid" text="name" hasChildren="hasChild" navigateUrl="navigateUrl" expanded="expanded"></e-treeview-fields> 
                </ejs-treeview> 
 
List<object> listdata = new List<object>(); 
            listdata.Add(new 
            { 
                id = 1, 
                name = "Australia", 
                hasChild = true, 
                expanded = true 
            }); 
            listdata.Add(new 
            { 
                id = 2, 
                pid = 1, 
                name = "New South Wales", 
                navigateUrl ="../Home/Contact" 
 
            }); 
 
Refer the sample link below. 
 
Refer the below link to know more about the TreeView component. 
 
 
 
 
Please let us know, if you need any further assistance on this. 
 
 
Regards,  
Sowmiya.P 


Loader.
Up arrow icon