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.

Displaying Tree View in drop-down

Thread ID:

Created:

Updated:

Platform:

Replies:

106425 Jan 7,2013 02:10 AM Oct 20,2016 06:16 AM ASP.NET MVC (Classic) 7
loading
Tags: Tools
Sivakumar
Asked On January 7, 2013 02:10 AM

Hi,

I am working ASP .NET MVC4. I would like to display Tree View data in drop-down. Could you please help me on this?

Example, I want to display data in drop-down as shown below. 
        Parent Node
            -->Child Node1
                        -->ChildNode11
                        -->.................
            --> Child Node2
            --> ............

The levels under Parent Node will be dynamic.

Thanks in advance.

Regards,
Siva

Meena [Syncfusion]
Replied On January 9, 2013 12:35 AM

Hi Sivakumar,

Thanks for contacting Syncfusion forums.

Your requirement of placing the treeview control inside a dropdown can be achieved by placing our TreeView control within our GenericDropdown control. Please refer the below code snippet.

<code>

  <div id="drop-down-contents" style="visibility: hidden">

    <%=Html.Syncfusion().TreeView("tree")  %>                   

   </div>

    

    <%=Html.Syncfusion().GenericDropDown("myDropDown")

       .TargetContentId("drop-down-contents")%>

</code>

In the above code,  the treeview contents are loaded dynamically in controller page . You can also load the treeview contents in view page itself. Please refer the below online UG link for creating the TreeView control and GenericDropdown control and their various features.

http://help.syncfusion.com/ug/asp.net%20mvc/tools/default.htm#!documents/genericdropdown.htm

http://help.syncfusion.com/ug/asp.net%20mvc/tools/default.htm#!documents/treeview.htm

We have also prepared a simple sample with the above requirement for your  convenience and it can be downloaded from the below link.

Please let us know if you have any other concerns.

Regards,

Meena



GenericDropDown_6b0f033c.zip

Sivakumar
Replied On January 10, 2013 04:00 AM

Hi Meena,

Thanks for the Solution. I tried with above solution in my application. It's working fine but I am facing one problem. I am loading this drop down based on user selection on other control. So when I change my selection it's appending with Old Tree View. So how can I reset Drop down items when selection changes?

Thanks in advance.

Regards,
Siva

Meena [Syncfusion]
Replied On January 15, 2013 11:25 AM

Hi Sivakumar,

 

Thanks for the update.

 

We have modified the previous sample to meet your requirement of rendering different treeview within Genericdropdown control based on user selection and it can be downloaded from the below link.

 

In the attached sample, we have a simple dropdown with three items. Based on its selection, different treeview will be rendered within Genericdropdown.

 

Kindly have a look at the sample and let us know if it helps.

 

Regards,

Meena



GenericDropDown_130b1ad9.zip

Sivakumar
Replied On February 18, 2013 04:40 AM

Hi Meena,

I tried with above solution and it's working fine now. Thanks for the solution.

Regards,
Siva

Meena [Syncfusion]
Replied On February 18, 2013 05:26 AM

Hi Siva,

 

Thanks for the update.

 

Kindly get back to us if you need further assistance. We will be happy to help you out.

 

Regards,

Meena


Samantha
Replied On October 19, 2016 01:54 AM

I am also trying to do the same thing. but i cant downloaded sample. why is that?

Dhivyalakshmi Thirumurugan [Syncfusion]
Replied On October 20, 2016 06:16 AM

Hi Samantha, 

The above given download link got broken due to data lost in our end . But you can find the live demo for this query in our demo site. Kindly check the below link.  


Also you can get the same online demo sample from your installed location. 

Please let us know if you have any queries. 

Regards, 
Dhivyalakshmi. 


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.

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.

;