This is a migrated thread and some comments may be shown as answers.

DropDownTree findItemByValue method not found

1 Answer 47 Views
DropDownTree
This is a migrated thread and some comments may be shown as answers.
Jerome MAILLEY
Top achievements
Rank 1
Jerome MAILLEY asked on 02 Mar 2017, 05:37 PM

Hi,

I'm using in an Asp application the DropDownTree web control.

According to your documentation, I wrote the following code :

function SelectNode(datakeyValue){
      var combo = $find("<%= RadDropDownTree.ClientID %>");
      var itm = combo.findItemByValue(dataKeyValue);
      itm.select();
      itm.set_checked(true);
}

 

However, IE displays an error message which says that the method « findItemByValue » is not found.

Thanks for your help,

Regards

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 07 Mar 2017, 11:04 AM

Hello Jerome,

The linked article is for the DropDownList control, not for the DropDownTree control.

With the DropDownTree, you should go through the RadTreeView:

Here is an example:

<telerik:RadDropDownTree ID="RadDropDownTree1"
                         runat="server"
                         CheckBoxes="SingleCheck"
                         EnableFiltering="True"
                         ExpandNodeOnSingleClick="True"
                         Skin="Metro">
    <DropDownSettings AutoWidth="Enabled"
                      OpenDropDownOnLoad="True" />
    <ButtonSettings ShowCheckAll="True" />
    <FilterSettings Highlight="None"
                    EmptyMessage="Search for a tree node..."></FilterSettings>
</telerik:RadDropDownTree>
<script>
    function pageLoad() {
        var dropdowntree1 = $find("<%=RadDropDownTree1.ClientID%>");
        var tree = dropdowntree1.get_embeddedTree();
        var node = tree.findNodeByValue("World_Continents");
        if (node) {
            node.select();
        }
    }
</script>
    protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        RadDropDownTree1.DataFieldID = "ID";
        RadDropDownTree1.DataFieldParentID = "ParentID";
        RadDropDownTree1.DataValueField = "Value";
        RadDropDownTree1.DataTextField = "Text";
        RadDropDownTree1.DataSource = GetData();
        RadDropDownTree1.DataBind();
    }
}
 
public DataTable GetData()
{
    DataTable table = new DataTable();
    table.Columns.Add("ID");
    table.Columns.Add("ParentID");
    table.Columns.Add("Value");
    table.Columns.Add("Text");
 
    table.Rows.Add(new String[] { "1", null, "World_Continents", "World Continents" });
    table.Rows.Add(new String[] { "2", null, "World_Oceans", "World Oceans" });
 
    table.Rows.Add(new String[] { "3", "1", "Asia", "Asia" });
    table.Rows.Add(new String[] { "4", "1", "Africa", "Africa" });
    table.Rows.Add(new String[] { "5", "1", "Australia", "Australia" });
    table.Rows.Add(new String[] { "6", "1", "Europe", "Europe" });
    table.Rows.Add(new String[] { "7", "1", "North_America", "North America" });
    table.Rows.Add(new String[] { "8", "1", "South_America", "South America" });
 
    table.Rows.Add(new String[] { "9", "2", "Arctic_Ocean", "Arctic Ocean" });
    table.Rows.Add(new String[] { "10", "2", "Atlantic_Ocean", "Atlantic Ocean" });
    table.Rows.Add(new String[] { "11", "2", "Indian_Ocean", "Indian Ocean" });
    table.Rows.Add(new String[] { "12", "2", "Pacific_Ocean", "Pacific Ocean" });
    table.Rows.Add(new String[] { "13", "2", "South_Ocean", "SouthOcean" });
 
    return table;
}


Regards,

Marin Bratanov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
DropDownTree
Asked by
Jerome MAILLEY
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or