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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Possible to select a note programmatically by the field id?

Thread ID:

Created:

Updated:

Platform:

Replies:

118797 Apr 10,2015 04:48 AM UTC Apr 13,2015 12:36 PM UTC ASP.NET MVC 1
loading
Tags: TreeView
Jimmy Soh
Asked On April 10, 2015 04:48 AM UTC

Hi

I have a TreeView from database in my View and I want to automatically select the note base on the ID (i_newscate_id) that pass into the View.
Is this possible?

<div style="width: 280px;">
    @Html.EJ().TreeView("NewsCate").TreeViewFields(s => s.Datasource((IEnumerable<CMSV5.ViewModels.NewsCategoryViewModel>)ViewBag.datasource).Id("i_newscate_id").ParentId("i_parent_id").Value("i_newscate_id").Text("u_title").HasChild("hasChild").Expanded("true")).LoadOnDemand(true).Width("auto").ClientSideEvents(e => e.NodeSelect("onSelect")).EnablePersistence(true)
</div>

Thank you.

Saranya Sivakumar [Syncfusion]
Replied On April 13, 2015 12:36 PM UTC

Hi Jimmy,

Thanks for using Syncfusion products.

We would like to let you know that, we can select the node based on the ID that pass in to the View by using AJAX success function. We can pass the ID from the controller in to the success function of AJAX and assign that ID to the “SelectNode” API of our Treeview control as shown in the following code snippet.

<code>

[script]

$.ajax({

url: 'DataReturn',

type: 'GET',

success: function (result) {

var treeObj = $("#NewsCate").data("ejTreeView");

treeObj.selectNode($("#" + result));

}

})

</code>

For your convenience we have prepared the sample based on your requirement and it can be downloaded from the following location.

http://www.syncfusion.com/uploads/user/forum/118797/TreeViewID-178931517.zip

Can you please check with the sample? If still you face any problem, kindly revert us by modifying the sample along with the replication procedure so that we can able to reproduce the issue in our end. This would be helpful for us to serve you better.

Please let us know if you have further concern.

Regards,

Saranya.S


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.

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

;