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

Executing event on Node Expand Image click in Rad Tree View

1 Answer 70 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
A2H
Top achievements
Rank 1
A2H asked on 07 Jul 2012, 09:56 AM
Hi,

I have a page designed with Rad Tree View. I need to acheive the following scenario.
In the expand node image click of rad tree view,I need to show a Tool Tip based on certain condition( See the Attached Image)

I have specified Rad Tool Tip control ,but I am not sure which control I will give for "TargetControlID".

I have used Javascript OnClientNodeExpaned event.
When I tried to display RadToolTip with out Target Control Id using Show() method.I am getting "Object expected Error".

How will I acheive the scenario.

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 09 Jul 2012, 09:46 AM
Hi A2H,

I suppose you want to show RadToolTip based on the expanded RadTreeNode. Here is the sample code.

ASPX:
<telerik:RadTreeView ID="RadTreeView1" runat="server" OnClientNodeExpanded="OnClientNodeExpanded">
  <Nodes>
     <telerik:RadTreeNode Text="RadTreeNode1">
        <Nodes>
              <telerik:RadTreeNode Text="RadTreeNode11">
              </telerik:RadTreeNode>
              <telerik:RadTreeNode Text="RadTreeNode12">
              </telerik:RadTreeNode>
              <telerik:RadTreeNode Text="RadTreeNode13">
              </telerik:RadTreeNode>
        </Nodes>
     </telerik:RadTreeNode>
     <telerik:RadTreeNode Text="RadTreeNode2">
        <Nodes>
              <telerik:RadTreeNode Text="RadTreeNode21">
              </telerik:RadTreeNode>
              <telerik:RadTreeNode Text="RadTreeNode22">
              </telerik:RadTreeNode>
              <telerik:RadTreeNode Text="RadTreeNode23">
              </telerik:RadTreeNode>
        </Nodes>
     </telerik:RadTreeNode>
     <telerik:RadTreeNode Text="RadTreeNode3">
        <Nodes>
              <telerik:RadTreeNode Text="RadTreeNode31">
              </telerik:RadTreeNode>
              <telerik:RadTreeNode Text="RadTreeNode32">
              </telerik:RadTreeNode>
              <telerik:RadTreeNode Text="RadTreeNode33">
           </telerik:RadTreeNode>
        </Nodes>
     </telerik:RadTreeNode>
  </Nodes>
</telerik:RadTreeView>
<telerik:RadToolTip ID="RadToolTip1" runat="server" Position="Center">
</telerik:RadToolTip>

JS:
<script type="text/javascript">
    function OnClientNodeExpanded(sender, args) {
        debugger;
        var tooltip = $find("<%= RadToolTip1.ClientID %>");
        if (args.get_node().get_text() == "RadTreeNode1") // Your Condition
        {
            tooltip.set_text("RadTreeNode1");
            tooltip.show();
        }
        else if (args.get_node().get_text() == "RadTreeNode2")// Your Condition
        {
            tooltip.set_text("RadTreeNode2");
            tooltip.show();
        }
        else if (args.get_node().get_text() == "RadTreeNode3")// Your Condition
        {
            tooltip.set_text("RadTreeNode3");
            tooltip.show();
        }
    }
</script>

Hope this helps.

Thanks,
Princy.
Tags
TreeView
Asked by
A2H
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or