Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsClientAPIClientAPIDNNTreeDNNTree
Previous
 
Next
New Post
2/3/2006 8:49 AM
 
I have a problem as I try to run the DNNTree from an .ASPX page within DotNetNuke. Everything seems to go fine, I look in the generated HTML and it's all there. However, I get a Javascript error on this line

       }

       for (var i=0; i<oNode.childNodeCount(); i++) //recursively call child rendering
             
this.renderNode(oNode.childNodes(i), oChildCont);
}

Ther error is 'null' is null or not an object . Seems some scripts are missing as it seems some initialization has not been performed. Since I'm doing this from a ASPX page unherited from UI.Page I'm using

Protected Overrides Sub OnInit(ByVal e As System.EventArgs)
      MyBase.OnInit(e)
      DotNetNuke.UI.Utilities.ClientAPI.HandleClientAPICallbackEvent(
Me.Page)
End Sub

The .aspx page loads the DNNTree as a userControl but it seems like the HTML is ok, the tree is generated, just not rendered through the javascript due to the break above.

Any light's on the above would be welcomed.

Cheers,
/Rob

 
New Post
2/3/2006 11:45 AM
 
Hard to say without seeing the whole code.  Let me suggest downloading the sampleapp I have written showcasing all the controls outside of dotnetnuke.  A live example of these controls can be found here.  Hopefully by comparing your code to mine you can find the solution.

 
New Post
2/9/2006 3:55 AM
 

I'm trying to get callback to work with the DNNTree. I don't know why this is not working.
I have tried to make my own clientside function and it works. like

DNNTree.JSFunction = "Test(this.node.id)" 

I get the node.id as expected, however as I use

.JSFunction = ClientAPI.GetCallbackEventReference(Me.Parent.Parent, "this.node.id", "successFunc", "this.node", "errorFunc")

If does not.

Any ideas?
Thanks,
/Rob

 
New Post
2/9/2006 6:12 PM
 

You problem is in the assumption that this contains the node that was clicked.  Instead this contains a reference to the treeview control itself.  To get a reference to the selected node you would use this.selTreeNode.

What I am confused about is the statement that your first example worked... I don't see how it could.  Here is a complete example (separate from DNN).

ASPX


<%@ Page Language="vb" AutoEventWireup="false" Codebehind="DNNTreeCallback.aspx.vb" Inherits="DotNetNuke.WebControls.Test.DNNTreeCallback"%>

<%@ Register TagPrefix="DNN" Namespace="DotNetNuke.UI.WebControls" Assembly="DotNetNuke.WebControls" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>

     <HEAD>

<script language=javascript>

<!--

     function callbackSuccess(result, ctx)

     {

          alert(result);

          alert(ctx.key);    //NodeID

     }

     function callbackError(result, ctx)

     {

          alert(result);

     }   

//-->

</script>

 

     </HEAD>

     <body MS_POSITIONING="GridLayout">

          <form id="Form1" method="post" runat="server">

              <DNN:DNNTree id="MyDNNTree" runat="server" TreeScriptPath="js/"></DNN:DNNTree>

          </form>

     </body>

</HTML>

 


CodeBehind


Imports DotNetNuke.UI.WebControls

Public Class DNNTreeCallback

     Inherits System.Web.UI.Page : Implements DotNetNuke.UI.Utilities.IClientAPICallbackEventHandler

 

#Region " Web Form Designer Generated Code "

 

     'This call is required by the Web Form Designer.

     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

 

     End Sub

     Protected WithEvents MyDNNTree As DotNetNuke.UI.WebControls.DnnTree

 

     'NOTE: The following placeholder declaration is required by the Web Form Designer.

     'Do not delete or move it.

     Private designerPlaceholderDeclaration As System.Object

 

     Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init

          'CODEGEN: This method call is required by the Web Form Designer

          'Do not modify it using the code editor.

          InitializeComponent()

     End Sub

 

#End Region

 

     Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

          'Put user code to initialize the page here

 

          Dim oNode As TreeNode = New TreeNode("ROOT")

          Me.MyDNNTree.TreeNodes.Add(oNode)

          Dim oNode2 As TreeNode = New TreeNode("DoCallBack")

          oNode2.Key = "MyKey"

          oNode2.ID = "MyID"

          oNode2.JSFunction = DotNetNuke.UI.Utilities.ClientAPI.GetCallbackEventReference(Me, "this.selTreeNode.id", "callbackSuccess", "this.selTreeNode", "callbackError")

          oNode.TreeNodes.Add(oNode2)

 

     End Sub

 

     Protected Overrides Sub OnInit(ByVal e As System.EventArgs)

          MyBase.OnInit(e)

          DotNetNuke.UI.Utilities.ClientAPI.HandleClientAPICallbackEvent(Me)

     End Sub

 

     Public Function RaiseClientAPICallbackEvent(ByVal eventArgument As String) As String Implements UI.Utilities.IClientAPICallbackEventHandler.RaiseClientAPICallbackEvent

          Return eventArgument & " " & Now.ToString

     End Function

End Class

 

 

 


 
New Post
2/9/2006 6:40 PM
 

Thanks again Jon, I knew I figured that selTreeNode out previously, but obviously that did not stick in my head long enough. It now delivers the key value I'm after and the RaiseClientAPICallbackevent is called. All systems green.

It seems like using the JSFunction cancels out the.ClickAction = eClickAction.Expand I guess I have to do this manually in the SuccessFunc.

Thanks Jon!

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsClientAPIClientAPIDNNTreeDNNTree


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out