RadTreeview in MOSS MasterPage

6 posts, 0 answers
  1. Arunkumar
    Arunkumar avatar
    3 posts
    Member since:
    Oct 2010

    Posted 21 Oct 2010 Link to this post

    Hi Team

    I added radtreeview in sharepoint master page for left navigation.
    the code below is i used
    <HEAD>
         <script language="javascript">
         //<![CDATA[
    function ClientNodeClicked(sender, eventArgs)
    {
    alert();
    window.setTimeout(function()
        {
            alert(sender.getWindowBounds().x);
        }, 0);
        var node = eventArgs.get_node();
       node.toggle();    
    }
    //]]>
    </script>
        </HEAD>
    <BODY scroll="yes" onload="javascript:if (typeof(_spBodyOnLoadWrapper) != 'undefined') _spBodyOnLoadWrapper();">
      <form runat="server" onsubmit="return _spFormOnSubmitWrapper();">
       <telerik:RadScriptManager runat="server" ID="RadScriptManager1"/>
    <asp:ContentPlaceHolder id="PlaceHolderLeftNavBar" runat="server">
                    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script language="javascript" type="text/javascript">
          //<![CDATA[
            function pageLoad() {
            alert('In');
                var tree = $find("<%= RadTreeView1.ClientID %>");
                if (tree) {
                    var location = window.location.pathname;
                    location = location.substring(location.lastIndexOf('/') + 1);
                    var nodeText = location.split('.');
                    var node = tree.findNodeByText(nodeText[0]);
                    alert(nodeText[0]);
                    if (node.get_level() != 0) {
                        var parentNode = node.get_parent();
                        node.get_parent().expand();
                        node.select();
                    }
                    else {
                        node.expand(true);
                        node.select();
                    }
                }
            }
    //]]>
       </script> </telerik:RadCodeBlock>
     
                    <telerik:RadTreeView ID="RadTreeView1" EnableEmbeddedSkins="false" DataSourceID="XmlDataSource1"
             runat="server" Skin="IV" OnClientNodeClicked="ClientNodeClicked" DataNavigateUrlField="ImageUrl">
             <DataBindings>
                    <telerik:RadTreeNodeBinding SelectedImageUrl="/IV/Img/selected_arrow.png" ExpandMode="ClientSide" DataMember="Node" TextField="Text" ExpandedField="Expanded" />
                </DataBindings>
            </telerik:RadTreeView>
            <asp:XmlDataSource runat="server" ID="XmlDataSource1" DataFile="TreeView.xml" XPath="/Tree/Node" />
             </asp:ContentPlaceHolder>
    </form>
      </BODY>

    but the pageLoad and ClientNodeClicked events are not firing in browser...

    help me to solve this issue...
  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 22 Oct 2010 Link to this post

    Hi Arunkumar,

    You should use RadScriptBlock for javascript code (not RadCodeBlock) and also set type="text/javascript" attribute to the <script> tag. Please try  it and let us know how it goes.

    Best wishes,
    Yana
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

  3. Arunkumar
    Arunkumar avatar
    3 posts
    Member since:
    Oct 2010

    Posted 22 Oct 2010 Link to this post

    Hi Yana

    Now i changed my code as per your instruction, but there is no effect

    <HEAD>
         <script language="javascript" type="text/javascript">
         //<![CDATA[
    function ClientNodeClicked(sender, eventArgs)
    {
    alert();
    window.setTimeout(function()
        {
            alert(sender.getWindowBounds().x);
        }, 0);
        var node = eventArgs.get_node();
       node.toggle();   
    }
    //]]>
    </script>
        </HEAD>
    <BODY scroll="yes" onload="javascript:if (typeof(_spBodyOnLoadWrapper) != 'undefined') _spBodyOnLoadWrapper();">
      <form runat="server" onsubmit="return _spFormOnSubmitWrapper();">
       <telerik:RadScriptManager runat="server" ID="RadScriptManager1"/>
    <asp:ContentPlaceHolder id="PlaceHolderLeftNavBar" runat="server">
                    <telerik:RadScriptBlock ID="RadCodeBlock1" runat="server">
        <script language="javascript" type="text/javascript">
          //<![CDATA[
            function pageLoad() {
            alert('In');
                var tree = $find("<%= RadTreeView1.ClientID %>");
                if (tree) {
                    var location = window.location.pathname;
                    location = location.substring(location.lastIndexOf('/') + 1);
                    var nodeText = location.split('.');
                    var node = tree.findNodeByText(nodeText[0]);
                    alert(nodeText[0]);
                    if (node.get_level() != 0) {
                        var parentNode = node.get_parent();
                        node.get_parent().expand();
                        node.select();
                    }
                    else {
                        node.expand(true);
                        node.select();
                    }
                }
            }
    //]]>
       </script> </telerik:RadScriptBlock>
      
                    <telerik:RadTreeView ID="RadTreeView1" EnableEmbeddedSkins="false" DataSourceID="XmlDataSource1"
             runat="server" Skin="IV" OnClientNodeClicked="ClientNodeClicked" DataNavigateUrlField="ImageUrl">
             <DataBindings>
                    <telerik:RadTreeNodeBinding SelectedImageUrl="/IV/Img/selected_arrow.png" ExpandMode="ClientSide" DataMember="Node" TextField="Text" ExpandedField="Expanded" />
                </DataBindings>
            </telerik:RadTreeView>
            <asp:XmlDataSource runat="server" ID="XmlDataSource1" DataFile="TreeView.xml" XPath="/Tree/Node" />
             </asp:ContentPlaceHolder>
    </form>
      </BODY>
  4. Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 27 Oct 2010 Link to this post

    Hi Arunkumar,

    Please excuse us for the delayed reply.
    We started investigating the issue, but we will need some more time.

    What is the exact version of SharePoint that you use?

    All the best,
    Kalina
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Arunkumar
    Arunkumar avatar
    3 posts
    Member since:
    Oct 2010

    Posted 27 Oct 2010 Link to this post

    HI Team

    I'm using Microsoft Office sharepoint server 2007 (MOSS) with the version of 12.0.6219.1000
    Windows Server 2003 with service pack2

    Hope this will help to resolve....


    Thanks
    Arunkumar
  6. Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 01 Nov 2010 Link to this post

    Hello Arunkumar,

    As I can see from the code snippet provided - you use RadScriptBlock to wrap the pageLoad function.
    Let me suggest you move the ClientNodeClicked function within this RadScriptBlock.

    Kind regards,
    Kalina
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top