We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to invoke a controller method on Node click

Thread ID:

Created:

Updated:

Platform:

Replies:

144473 May 8,2019 08:17 AM UTC May 13,2019 05:00 AM UTC ASP.NET Core - EJ 2 3
loading
Tags: TreeView
Muhammad Tassadaque Zia
Asked On May 8, 2019 08:17 AM UTC

Hi
I am trying to use treeview for redirection to different action based on the action assigned. I tried to use navigateUrl property but it is not working. Sample is attached. I couldn't find a sample in documentation also for this.

Attachment: RemoteData_d32dae7b.zip

Muhammad Tassadaque Zia
Replied On May 9, 2019 07:20 PM UTC

Is more clarity required to get the answer or I am missing something

Christopher Issac Sunder K [Syncfusion]
Replied On May 10, 2019 06:32 AM UTC

Hi Muhammad, 

Greetings from Syncfusion support. 

In the attached sample, you have declared the navigateURL directly inside the fields tag. So that it is not working properly. We have to define the navigateURL individually for each node (like id, parentID defined for each node). Please find the code snippet. 

// Controller part 
public string nodeURL { get; set; } 
TreeData.Add(new ParentNodeViewModel { nodeId = "01", nodeText= "Local Disk (C:)", expanded= true, hasChild= true, nodeURL="/Home/About" }); 
TreeData.Add(new ParentNodeViewModel { nodeId = "01-01", nodeText = "Program Files", hasChild = true, pid = "01", nodeURL= "https://ej2.syncfusion.com/demos/#/material/treeview/check-box.html" }); 

//view part 
<ejs-treeview id="tree"> 
    <e-treeview-fields navigateUrl="nodeURL" id="nodeId" parentId="pid" text="nodeText" hasChildren="hasChild" expanded="expanded"> 
        <e-data-manager url="/Treeview/GetAllData" adaptor="ODataV4Adaptor" crossDomain="true" offline="true"></e-data-manager> 
    </e-treeview-fields> 
</ejs-treeview> 

  
Please check the above sample and get back to us if you need any further assistance. 

Thanks, 
Christo 


Muhammad Tassadaque Zia
Replied On May 13, 2019 05:00 AM UTC

Thanks It solved my issue

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon