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

RadDropDowmTree

7 Answers 28 Views
DropDownTree
This is a migrated thread and some comments may be shown as answers.
Vishram
Top achievements
Rank 1
Vishram asked on 19 May 2014, 10:36 AM
Hi, I am writing the statement like,
 int value=Convert.ToInt32(objRadDropDowmTree.EmbadedTree.Nodes[1].Value);

But its showing an error "Input string was not correct"
 Please tell me, how to access any specific node value? 

Please also help me, how to assign tooltip in RadDropDowmTree Nodes .

7 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 19 May 2014, 12:12 PM
Hi Vishram,

Please have a look into the C# code snippet to access the value of the node and assign tooltip for the node.

C#:
protected void RadDropDownTree1_NodeDataBound(object sender, DropDownTreeNodeDataBoundEventArguments e)
{
    string value = string.Empty;
    foreach (RadTreeNode node in RadDropDownTree1.EmbeddedTree.Nodes)
    {
        node.ToolTip = node.Text;
        value = node.Value;
        foreach (RadTreeNode subnode in node.GetAllNodes())
        {
            subnode.ToolTip = subnode.Text;
        }
    }
}

Thanks,
Shinu.
0
Vishram
Top achievements
Rank 1
answered on 19 May 2014, 12:32 PM
Hi Shinu,
 Actually I am accessing node value using index, and assigning that value in a integer variable but showing "input string was not correct"...

Please see this statement....  

 int value= Convert.ToInt32(objRadDropDowmTree.EmbadedTree.Nodes[1].Value);
0
Shinu
Top achievements
Rank 1
answered on 20 May 2014, 02:50 AM
Hi Vishram,

The error means that the string you are trying to parse an integer doesn't actually contain a valid integer. Can you please check the DataValueField have integer values. Please have a look into the sample code snippet which works fine at my end.

ASPX:
<telerik:RadDropDownTree ID="RadDropDownTree1" runat="server" DataSourceID="SqlDataSource1"
    DataTextField="text" DataFieldID="id" DataFieldParentID="parentid" DataValueField="id">
</telerik:RadDropDownTree>
<telerik:RadButton ID="RadButton1" runat="server" Text="Value" OnClick="RadButton1_Click">
</telerik:RadButton>

C#:
protected void RadButton1_Click(object sender, EventArgs e)
{
    int value = Convert.ToInt32(RadDropDownTree1.EmbeddedTree.Nodes[1].Value);
}

Please provide your full code if it doesn't help.
Thanks,
Shinu.
0
Asutosh
Top achievements
Rank 1
answered on 22 Jul 2014, 06:10 AM
hi shinu 
i am using raddropdown tree
i want to add tool tip in that 
like 
i have 
manager
   -abc 
   -def 
   -ghi
   -abcdefghi
employee
   -opq
   -wer
   -abcdefghijkl

i have data like that where manager is parent and abc,def,ghi,abcdefghi are child of that
so i want to show abcd... when name is long and when hover on that name will show in tool tip 
how can i set that?







0
Shinu
Top achievements
Rank 1
answered on 22 Jul 2014, 09:03 AM
Hi Asutosh,

Please try the below JavaScript to achieve your scenario.

JavaScript:
function pageLoad() {
    var treeView = $find("<%=rtreeviewEmployees.ClientID%>");
    var count = treeView.get_allNodes().length, index, node;
    for (index = 0; index < count; index++) {
        node = treeView.get_allNodes()[index];
        if (node._hasChildren() == false) {
            if (node.get_text().length > 4) {
                node._element.title = node.get_text();
                node.set_text(node.get_text().substring(0, 4) + "...");
            }
        }
    }
}

Thanks,
Shinu.
0
Asutosh
Top achievements
Rank 1
answered on 22 Jul 2014, 10:51 AM
hi shinu thanks for your reply
bt its not works at my end
and i dont want to formate data 
i jst want to display formate 
like i have done in below code
this way i want to do
name will  b there bt it show limited width then show ...  
how can i do in raddropdown tree?
 <div style="white-space: nowrap; overflow: hidden; position: absolute; text-overflow: ellipsis; width: 32%; height: 30px; margin-top: -20px; color: white; margin-left: 60px">
                                            <asp:Label ID="lblfirstdivheader" runat="server" Text="" Style="color: white; background-color: #404040"></asp:Label>
                                        </div>
0
Shinu
Top achievements
Rank 1
answered on 23 Jul 2014, 03:25 AM
Hi Asutosh,

Please try the below CSS code snippet to achieve your scenario.

CSS:
div.RadTreeView .rtIn
{
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
}
div.RadTreeView .rtUL .rtIn
{
    width: 80px;
}
div.RadTreeView .rtUL .rtUL .rtIn
{
    width: 50px;
}

Thanks,
Shinu.
Tags
DropDownTree
Asked by
Vishram
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Vishram
Top achievements
Rank 1
Asutosh
Top achievements
Rank 1
Share this question
or