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

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Duplicate ClientAPI.RegisterClientVariable function outside of DNNDuplicate ClientAPI.RegisterClientVariable function outside of DNN
Previous
 
Next
New Post
6/20/2007 12:50 PM
 

I have a non DNN application that needs some of the DNN functionality found in the ClientAPI. Particularly, I need to duplicate the functionality of the RegisterClientVariable() and GetClientVariable() functions. I've poured over the source code and conceptually it makes sense (mostly) but I can't seem to figure out how they got the server to update a client-side hidden field without causing a postback. Can anyone help me figure out how this is accomplished? The client-side part of it is a piece of cake. I can get javascript to read and write values all day long. What I need is for the server to do the same without posting back.

 
New Post
6/20/2007 1:42 PM
 

The ClientAPI can stand on its own outside of DNN, as demonstrated by the http://webcontrols.dotnetnuke.com site.  Why not simply add a reference to the dll and add the js files to your non-dnn app?


 
New Post
6/20/2007 5:52 PM
 

Am I missing something? Just to test it, I created a simple aspx page. Every time I make the call to ClientAPI.RegisterClientVariable() I get a NullReferenceException. Further investigation shows that I don't have the "__dnnVariable" hidden control on my page at all. What gives? Please help! I'm losing hair rapidly!

Below is the ENTIRE codebehind for the page.

 

Imports

DotNetNuke.UI.Utilities

Partial

 

 

     Protected Sub ParentOnLoad(ByVal sender As Object, ByVal e As System.EventArgs)Me)    End Sub

 

 

 

    Protected Overrides Sub OnInit(ByVal e As System.EventArgs)    MyBase.OnInit(e)    If ClientAPI.NeedsDNNVariable(Me) Then

 

 

     AddHandler Me.Load, AddressOf ParentOnLoad        End If

 

    End Sub

 

 

 

    Public Function RaiseClientAPICallbackEvent(ByVal eventArgument As String) As String Implements DotNetNuke.UI.Utilities.IClientAPICallbackEventHandler.RaiseClientAPICallbackEvent        Return DateTime.Now.ToString()    End Function

 

        ClientAPI.RegisterClientVariable(Page,

 

End


    Protected Sub btnSetVarOnServer_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSetVarOnServer.Click"ServerVar", "This is a server variable", True)    End Sub Class

 

        ClientAPI.RegisterDNNVariableControl(

 

Class VBTest    Inherits System.Web.UI.Page    Implements DotNetNuke.UI.Utilities.IClientAPICallbackEventHandler

 
New Post
6/20/2007 5:53 PM
 

Somehow that codebehind paste got corrupted. Here it is again.

Imports DotNetNuke.UI.Utilities

Partial Class VBTest
    Inherits System.Web.UI.Page
    Implements DotNetNuke.UI.Utilities.IClientAPICallbackEventHandler

    Protected Sub ParentOnLoad(ByVal sender As Object, ByVal e As System.EventArgs)
        ClientAPI.RegisterDNNVariableControl(Me)
    End Sub

    Protected Overrides Sub OnInit(ByVal e As System.EventArgs)
        MyBase.OnInit(e)
        If ClientAPI.NeedsDNNVariable(Me) Then
            AddHandler Me.Load, AddressOf ParentOnLoad
        End If
    End Sub

    Public Function RaiseClientAPICallbackEvent(ByVal eventArgument As String) As String Implements DotNetNuke.UI.Utilities.IClientAPICallbackEventHandler.RaiseClientAPICallbackEvent
        Return DateTime.Now.ToString()
    End Function

    Protected Sub btnSetVarOnServer_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSetVarOnServer.Click
        ClientAPI.RegisterClientVariable(Page, "ServerVar", "This is a server variable", True)
    End Sub
End Class

 
New Post
6/21/2007 9:22 AM
 

I am a little confused why I am seeing Callback code here, I'm assuming you are not trying to use callbacks for your example?

Have you tried using the sample you can download from webcontrols.dotnetnuke.com?

If I had to guess, I would try simply adding the __dnnvariable hidden control directly in the your aspx page (just to troubleshoot)

<input type="hidden" name="__dnnVariable" id="__dnnVariable" runat="server">

 


 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Duplicate ClientAPI.RegisterClientVariable function outside of DNNDuplicate ClientAPI.RegisterClientVariable function outside of DNN


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