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 ForumsClientAPIClientAPILogin Required for new Module using Client APILogin Required for new Module using Client API
Previous
 
Next
New Post
11/3/2006 10:46 AM
 
I am currently developing a module for DotNetNuke 4.3.5, and trying to use the Client API. I have duplicated the HelloAjax ascx and javascript file as in the example. I am getting a fast array of spurious errors, dependand on how much I duplicate the code. If I remove the the lines;

If ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.XMLHTTP) _
             AndAlso ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.XML) Then
                ClientAPI.RegisterClientReference(Me.Page, ClientAPI.ClientNamespaceReferences.dnn_xml)
                ClientAPI.RegisterClientReference(Me.Page, ClientAPI.ClientNamespaceReferences.dnn_xmlhttp)

End If

I get the Cast Error others have reported, when included 404 Control Not Found error. But when logged in as a subscriber, portal admin or host it all works fine.

Here is the ascx file

<%@ Control Language="VB" AutoEventWireup="false" CodeFile="SearchHBJobs.ascx.vb" Inherits="HiBrowWeb.Modules.HBJobs.SearchHBJobs" %>
<asp:label id="Label1" runat="server">Enter Text</asp:label><br>
<asp:textbox id="TextBox1" runat="server"></asp:textbox><br>
<INPUT id="Button1" type="button" value="Invoke AJAX Method" name="Button1" runat="server">
<INPUT id="chkContinuous" type="checkbox" name="chkContinuous" runat="server">&nbsp;Continuous&nbsp;<BR>

Here is the vb file

Imports DotNetNuke
Imports DotNetNuke.UI.Utilities

Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls


Namespace HiBrowWeb.Modules.HBJobs
    Partial Class SearchHBJobs
        Inherits Entities.Modules.PortalModuleBase
        Implements Entities.Modules.IActionable
        Implements IClientAPICallbackEventHandler
#Region "Private Members"
#End Region
#Region "Event Handlers"
       
        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            ''these won't be necessary in next release after 3.2.0
            'If ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.XMLHTTP) _
            '  AndAlso ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.XML) Then
            '    ClientAPI.RegisterClientReference(Me.Page, ClientAPI.ClientNamespaceReferences.dnn_xml)
            '    ClientAPI.RegisterClientReference(Me.Page, ClientAPI.ClientNamespaceReferences.dnn_xmlhttp)

            'Only this line will be necessary after 3.2
            Me.Button1.Attributes.Add("onclick", ClientAPI.GetCallbackEventReference(Me, "dnn.dom.getById('" & Me.TextBox1.ClientID & "').value", "successFunc", "'" & Me.ClientID & "'", "errorFunc"))
            Me.chkContinuous.Attributes.Add("onclick", "toggleCont('" & Me.ClientID & "')")

            If Me.Page.ClientScript.IsClientScriptBlockRegistered("helloajax.js") = False Then
                Me.Page.ClientScript.RegisterClientScriptBlock(Me.GetType, "helloajax.js", "<script language=javascript src=""" & Me.ModulePath & "helloajax.js""></script>")
            End If

            'End If

        End Sub
#End Region
#Region "Optional Interfaces"
        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' Registers the module actions required for interfacing with the portal framework
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        ''' <history>
        ''' </history>
        ''' -----------------------------------------------------------------------------
        Public ReadOnly Property ModuleActions() As Entities.Modules.Actions.ModuleActionCollection Implements Entities.Modules.IActionable.ModuleActions
            Get
                Dim Actions As New Entities.Modules.Actions.ModuleActionCollection
                Actions.Add(GetNextActionID, Localization.GetString(Entities.Modules.Actions.ModuleActionType.AddContent, LocalResourceFile), Entities.Modules.Actions.ModuleActionType.AddContent, "", "", EditUrl(), False, Security.SecurityAccessLevel.Edit, True, False)
                Return Actions
            End Get
        End Property


        Protected Function RaiseClientAPICallbackEvent(ByVal EventArgs As String) As String _
            Implements IClientAPICallbackEventHandler.RaiseClientAPICallbackEvent
            Return "Hello: " & EventArgs
        End Function
#End Region
    End Class
End Namespace


And JS file

function successFunc(result, ctx)
{
    if (dnn.dom.getById(ctx + '_chkContinuous').checked)
    {
        dnn.dom.getById(ctx + '_Label1').innerHTML = result;
        dnn.doDelay(ctx, 1000, doCont, ctx);
    }
    else
        alert('result: ' + result + '\ncontext:' + ctx);
}

function doCont(ns)
{
    dnn.dom.getById(ns + '_Button1').onclick();
}

function errorFunc(result, ctx)
{
    alert(result);
}

function toggleCont(ns)
{
    if (dnn.dom.getById(ns + '_chkContinuous').checked)
        doCont(ns);
}


The most curiouse thing is, as is the HelloAjax module works absolutly fine. Also just a bit of background the module was originally generated by the DotNetNuke Starter Kit.

Additionally I have tested another suggestion on this forum, of diabling the caching for the module. This did not solve my issue.

Thanks to anyone that can help.
 
New Post
11/7/2006 9:59 AM
 

I have tried this exact code against the 4.3.5 started kit.  Other than having to fix the ambiguious namespace of Security (it wouln't compile), everything works fine.

Actions.Add(GetNextActionID, Localization.GetString(Entities.Modules.Actions.ModuleActionType.AddContent, LocalResourceFile), Entities.Modules.Actions.ModuleActionType.AddContent, "", "", EditUrl(), False, Security.SecurityAccessLevel.Edit, True, False)

I don't think this is your issue though...  all I can say is I cut and paste your code into my 4.3.5 starter kit.  Manually added the module def, and placed this on a new page.  Then I logged out and tried it.  No errors...

Any chance you could post a URL exhibiting these errors?


 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsClientAPIClientAPILogin Required for new Module using Client APILogin Required for new Module using Client API


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