Before Client click in new Version of Rad Treeview

3 posts, 0 answers
  1. Rahul Khinvasara
    Rahul Khinvasara avatar
    303 posts
    Member since:
    Aug 2007

    Posted 25 Jun 2008 Link to this post

    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. Kevin Babcock
    Kevin Babcock avatar
    189 posts
    Member since:
    Mar 2007

    Posted 25 Jun 2008 Link to this post

    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:

    1 <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"
    2     <script type="text/javascript"
    3         function handleNodeClick(sender, eventArgs) { 
    4             var node = eventArgs.get_node(); 
    5              
    6             // put the rest of your code here... 
    7         }            
    8     </script> 
    9 </telerik:RadCodeBlock> 
    10  
    11 <telerik:RadTreeView ID="RadTreeView1" runat="server" 
    12     OnClientNodeClicking="handleNodeClick"
    13     <Nodes> 
    14         <!-- Insert nodes here, or you can add them  
    15              from a datasource or programatically    --> 
    16     </Nodes> 
    17 </telerik:RadTreeView> 

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

    Regards,
    Kevin Babcock
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 25 Jun 2008 Link to this post

    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
Back to Top