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. Image for the cookie policy date

TreeSet Datasource

Hi there,

Is it possible to have drop down filled in based on datasource which has tree structure data set (stored in database).

And display / render it with either
  1. Check-box options 
  2. Single selection based option

Regards
Prasanthan

3 Replies

SS Saranya Sivakumar Syncfusion Team October 28, 2015 01:01 PM UTC

Hi Prasanthan,

Thanks for contacting Syncfusion support.

We can bind the Treestructured data to the Dropdownlist control with the checkboxes using ContentTemplate API. Using ContentTemplate we can define the customized structure for the content of the Dropdownlist control as shown in the following code snippet.

<code>

<ej:DropDownList ID="selectFolder" runat="server" ClientIDMode="Static" Width="280px" PopupWidth="280px" PopupHeight="280px" WatermarkText="Select any value">

                <Items>

                    <ej:DropDownListItem>

                        <ContentTemplate>

                            <ej:TreeView ID="Treeview" runat="server" DataTextField="Text" ClientIDMode="Static" DataIdField="ID" DataParentIdField="ParentID"

                                DataHasChildField="HasChild" ClientSideOnNodeExpanded="checkScroll" ClientSideOnNodeChecked="onNodeCheck" ClientSideOnNodeUnchecked="onNodeUnCheck" ClientSideOnNodeSelected="onNodeSelect" ShowCheckbox="true" ClientSideOnNodeCollapsed="checkScroll">

                            </ej:TreeView>

                        </ContentTemplate>

                    </ej:DropDownListItem>

                </Items>

            </ej:DropDownList>

</code>

We have prepared the simple sample Dropdownlist with Treeview along with checkbox enabled and the same can be downloaded from the following location.

Sample Location: Sample

Regards,

Saranya.S



PR Prasanth October 28, 2015 01:11 PM UTC

Hi Saranya,

Thanks for the reply, I thought I have posted the question on ASP.NET MVC forum, I wanted to know how this can be achieved in ASP.NET MVC.  I will post the question on correct forum

Here is the ASP.NET MVC forum thread link, if you have an answer for MVC framework please update the forum, otherwise I will wait for an answer 

http://www.syncfusion.com/forums/120928/treeset-datasource

Apologies for the confusion

Regards
Prasanthan


SS Saranya Sivakumar Syncfusion Team October 29, 2015 11:49 AM UTC

Hi Prasanthan,

As per your request we have prepared EJMVC sample for Dropdownlist with Treeview control as datasource and the same can be downloaded from the following location.

https://www.syncfusion.com/downloads/support/forum/120949/ze/DDLMVC311301045

Please let us know if you have any other queries.

Regards,

Saranya.S


Loader.
Live Chat Icon For mobile
Up arrow icon