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

Before Client click in new Version of Rad Treeview

2 Answers 120 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Rahul Khinvasara
Top achievements
Rank 1
Rahul Khinvasara asked on 25 Jun 2008, 05:10 AM
Hi,
In my application I have replaced controls with this new version of  Asp.net for ajax.
There is one RadTreeview on whose BeforeClientClick i had written one script but after changing it to new version, this script is not working.
Below is the code:

<

telerik:RadTreeView ID="tvDetractionTypes" runat="server" DataTextField="Title" DataFieldID="ID"

BeforeClientClick="handleNodeClick" DataValueField="ID" DataFieldParentID="ParentDetractionTypeID"

Skin="Office2007" DataSourceID="dsDetractionTypes" Height="150px" Width="250px"

OnNodeBound="tvDetractionTypes_NodeBound">

</telerik:RadTreeView>

<

script type="text/javascript">

function

handleNodeClick(node)

{

//if this is a parent node, expand it and select the first child

if (node.Parent == null && node.Nodes.length > 0)

{

node.Expand();

node.TreeView.UnSelectAllNodes();

node.Nodes[0].Select();

return false;

}

// Unlock any locked sliders

SliderArrays[0][idxSliderLocked] =

false;

SliderArrays[1][idxSliderLocked] =

false;

SliderArrays[2][idxSliderLocked] =

false;

SliderArrays[3][idxSliderLocked] =

false;

// Make sliders visible

SliderArrays[0][idxSliderDisplay] =

true;

SliderArrays[1][idxSliderDisplay] =

true;

SliderArrays[2][idxSliderDisplay] =

true;

SliderArrays[3][idxSliderDisplay] =

true;

// Redraw the sliders to reflect the new default values

SliderArrays[0][idxSliderDisplayWeight] = node.Attributes[

"DefaultTech"];

SliderArrays[1][idxSliderDisplayWeight] = node.Attributes[

"DefaultEquip"];

SliderArrays[2][idxSliderDisplayWeight] = node.Attributes[

"DefaultPatient"];

SliderArrays[3][idxSliderDisplayWeight] = node.Attributes[

"DefaultProcess"];

SliderDrawTable();

// Change the default DV

// Change the tooltip text

return true;

}

</script>

Can anyone tell which event should be used now..?
and how to get node and its attributes in my above script.
I tried using OnClientClicking but not succeed.
Plese help.
Thanks.

2 Answers, 1 is accepted

Sort by
0
Kevin Babcock
Top achievements
Rank 1
answered on 25 Jun 2008, 05:56 AM
Hi Rahul,

Please take a look at this link to get information on the client-side events and properties available to you with the RadTreeView control.

For your specific problem, you can use the OnClientNodeClicking event. I have created a simple example to demonstrate how to use this event to access the node that caused it:

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"
    <script type="text/javascript"
        function handleNodeClick(sender, eventArgs) { 
            var node = eventArgs.get_node(); 
             
            // put the rest of your code here... 
        }            
    </script> 
</telerik:RadCodeBlock> 
 
<telerik:RadTreeView ID="RadTreeView1" runat="server" 
    OnClientNodeClicking="handleNodeClick"
    <Nodes> 
        <!-- Insert nodes here, or you can add them  
             from a datasource or programatically    --> 
    </Nodes> 
</telerik:RadTreeView> 

I hope this was helpful. Please let me know if you continue to have problems.

Regards,
Kevin Babcock
0
Atanas Korchev
Telerik team
answered on 25 Jun 2008, 05:58 AM
Hello Rahul Khinvasara,

Please check this help page which describes in detail the changes between the "classic" and ajax treeview. You should now use the OnClientNodeClicking event instead.
 
All the best,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
TreeView
Asked by
Rahul Khinvasara
Top achievements
Rank 1
Answers by
Kevin Babcock
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or