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 ForumsClientAPIClientAPIClientAPI C# example, VWD, DNN403 - Firefox issue?ClientAPI C# example, VWD, DNN403 - Firefox issue?
Previous
 
Next
New Post
5/10/2006 4:24 AM
 
Hi,
I spend quite some time getting the ClientAPI callback stuff to work. I'm quite new to web programming so I couldn't figure out why it wouldn't work as I expected. However, after a lot of hours I tried using internet explorer  instead of firefox... and suddenly the code executed as expected!
In firefox I recieved the following error message:  when trying to execute the callback as descriped in the ClientAPI documentation:
"Failed: null - null (dnn_ctr368_ViewTestCallbackButton1)". (indication failure during execution - the errorFunc method)
Opening the portal in internet explorer and hitting the same button gives:
"Received: Hello: test(dnn_ctr368_ViewTestCallbackButton1)" (indication success during execution - the successFunc method).

Can anyone tell me what could be the reason for the script not executing as expected in firefox?

Anyways, below I've inserted the code for the viewModule part after I did "Add new Item" --> DNN module using the DNN403 starter pack in visual web developer (VWD) and using c# as the language. I called the module TestCallBack and placed a button on the webform.Thanks a lot to John Stodd for making this post.
Best Regards
Johannes

/*
' DotNetNuke® - http://www.dotnetnuke.com
' Copyright (c) 2002-2005
' by Perpetual Motion Interactive Systems Inc. ( http://www.perpetualmotion.ca )
'
' Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
' documentation files (the "Software"), to deal in the Software without restriction, including without limitation
' the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
' to permit persons to whom the Software is furnished to do so, subject to the following conditions:
'
' The above copyright notice and this permission notice shall be included in all copies or substantial portions
' of the Software.
'
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
' TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
' THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
' CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
' DEALINGS IN THE SOFTWARE.
 */

using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Web.UI;
using System.Web.UI.WebControls;

using DotNetNuke;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Modules.Actions;
using DotNetNuke.Security;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Services.Localization;
using DotNetNuke.UI.Utilities;

namespace YourCompany.Modules.TestCallback
{
    /// -----------------------------------------------------------------------------
    /// <summary>
    /// The ViewTestCallback class displays the content
    /// </summary>
    /// <remarks>
    /// </remarks>
    /// <history>
    /// </history>
    /// -----------------------------------------------------------------------------
    partial class ViewTestCallback : PortalModuleBase, IActionable, IClientAPICallbackEventHandler
    {

        #region Public Methods

        public bool DisplayAudit()
        {
            bool retValue = false;

            if ((string)Settings["auditinfo"] == "Y")
            {
                retValue = true;
            }

            return retValue;
        }

        #endregion

        #region Event Handlers

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void Page_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                TestCallbackController objTestCallbacks = new TestCallbackController();
                List<TestCallbackInfo> colTestCallbacks;

                //get the content from the TestCallback table
                colTestCallbacks = objTestCallbacks.GetTestCallbacks(ModuleId);

                if (colTestCallbacks.Count == 0)
                {
                    //add the content to the TestCallback table
                    TestCallbackInfo objTestCallback = new TestCallbackInfo();
                    objTestCallback.ModuleId = ModuleId;
                    objTestCallback.Content = Localization.GetString("DefaultContent", LocalResourceFile);
                    objTestCallback.CreatedByUser = this.UserId;
                    objTestCallbacks.AddTestCallback(objTestCallback);

                    //get the content from the TestCallback table
                    colTestCallbacks = objTestCallbacks.GetTestCallbacks(ModuleId);
                }

                //bind the content to the repeater
                lstContent.DataSource = colTestCallbacks;
                lstContent.DataBind();

                if(ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.XMLHTTP) && 
                    ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.XML))
                {
                        ClientAPI.RegisterClientReference(this.Page, ClientAPI.ClientNamespaceReferences.dnn_xml);
                        ClientAPI.RegisterClientReference(this.Page, ClientAPI.ClientNamespaceReferences.dnn_xmlhttp);
                    }


                   
                //Only this line will be necessary after 3.2
                this.Button1.Attributes.Add("onclick", ClientAPI.GetCallbackEventReference(this, "'test'", "successFunc", "this", "errorFunc"));


                if (this.Page.ClientScript.IsClientScriptBlockRegistered("test.js") == false)
                {
                    this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "test.js", "<script language=javascript src=\"" + this.ModulePath + "test.js\"></script>");               
                }

            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }

        }

        protected void lstContent_ItemDataBound(System.Object sender, System.Web.UI.WebControls.DataListItemEventArgs e)
        {
            string strContent = "";

            //add content to template
            if (((string)Settings["template"] != null) && ((string)Settings["template"] != ""))
            {
                strContent = (string)Settings["template"];
                ArrayList objProperties = CBO.GetPropertyInfo(typeof(TestCallbackInfo));
                int intProperty;
                foreach (PropertyInfo objPropertyInfo in objProperties)
                {
                    strContent = strContent.Replace("[" + objPropertyInfo.Name.ToUpper() + "]", DataBinder.Eval(e.Item.DataItem, objPropertyInfo.Name).ToString());
                }
            }
            else
            {
                strContent = (string)DataBinder.Eval(e.Item.DataItem, "Content");
            }

            //assign the content
            Label lblContent = (Label)e.Item.FindControl("lblContent");
            lblContent.Text = strContent;
        }

        #endregion

        #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 ModuleActionCollection ModuleActions
        {
            get
            {
                ModuleActionCollection Actions = new ModuleActionCollection();
                Actions.Add(this.GetNextActionID(), Localization.GetString(ModuleActionType.AddContent, this.LocalResourceFile), ModuleActionType.AddContent, "", "", this.EditUrl(), false, SecurityAccessLevel.Edit, true, false);
                return Actions;
            }
        }

        #endregion

   
#region IClientAPICallbackEventHandler Members

public string  RaiseClientAPICallbackEvent(string eventArgument)
{
     return "Hello: " + eventArgument;
}


#endregion

}
}

***************************
The following is the content of the "test.js" file which I placed in the desktopmodules/testCallback folder

function successFunc(result, ctx)
{
alert('received: ' + result + ' (' + ctx.id + ')');
}

function errorFunc(result, ctx)
{
alert('failed: ' + result + ' (' + ctx.id + ')');
}

 
New Post
5/21/2006 4:22 PM
 
Hi,

   Try placing language=javascript within quotes...

-Rafiq
http://www.ajaxtoday.com
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsClientAPIClientAPIClientAPI C# example, VWD, DNN403 - Firefox issue?ClientAPI C# example, VWD, DNN403 - Firefox issue?


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