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 ForumsClientAPIClientAPIDotNetNuke.UI.Utilities.ClientAPI.GetClientVariableDotNetNuke.UI.Utilities.ClientAPI.GetClientVariable
Previous
 
Next
New Post
9/16/2006 6:29 PM
 
I have registered a client variable and want to access it on a client postpack but I dont get anything back - how would I need to do that?

Dylan Barber http://www.braindice.com - Dotnetnuke development classes - skins and modules
 
New Post
9/18/2006 9:16 AM
 
This question is a little too vague to answer.  Could you provide some code?

 
New Post
9/18/2006 9:51 AM
 

Sure

in pageload i do this

If DotNetNuke.UI.Utilities.ClientAPI.BrowserSupportsFunctionality(DotNetNuke.UI.Utilities.ClientAPI.ClientFunctionality.XMLHTTP) AndAlso DotNetNuke.UI.Utilities.ClientAPI.BrowserSupportsFunctionality(DotNetNuke.UI.Utilities.ClientAPI.ClientFunctionality.XML) Then

DotNetNuke.UI.Utilities.ClientAPI.RegisterClientReference(Me.Page, DotNetNuke.UI.Utilities.ClientAPI.ClientNamespaceReferences.dnn_xml)

DotNetNuke.UI.Utilities.ClientAPI.RegisterClientReference(Me.Page, DotNetNuke.UI.Utilities.ClientAPI.ClientNamespaceReferences.dnn_xmlhttp)

DotNetNuke.UI.Utilities.ClientAPI.RegisterClientReference(Me.Page, DotNetNuke.UI.Utilities.ClientAPI.ClientNamespaceReferences.dnn)

End If

DotNetNuke.UI.Utilities.ClientAPI.RegisterClientVariable(Me.Page, "ListNumber", "15", False)

 

then in my raisecallback event i do this

Dim ListID As Integer = Cint(DotNetNuke.UI.Utilities.ClientAPI.GetClientVariable(Me, "ListNumber"))

But listit is always nothing - maybe I am not doing something right or the client callback doesnt work that way


Dylan Barber http://www.braindice.com - Dotnetnuke development classes - skins and modules
 
New Post
9/18/2006 10:30 AM
 

Your original post said a client postback, not a client callback, hence my confusion.  By default, a callback will only contain the arguments passed in it.  However, as the Client Callback document states

Accessing FORM Values In A Callback

Starting with version 1.2 of the ClientAPI (included in DNN 3.3/4.1), you will now be able to specify that your callback should contain the values of one or more FORM elements.  For example, if you wish to have the entire up-to-date form values pushed to the server you would register your client callback script like this.

mybutton.attributes.add("onclick", GetCallbackEventReference(Page, "'test'", "successFunc", "this", "errorFunc", "Form")

Note:  The last parameter (Form) specifies the element ID whose children we wish to post the values for.

You would then be able to access the form values during a callback through code like this.

Dim sVal As String = Request(Me.txt.ClientID)

Note:  You cannot use the Me.txt.Value property since a callback will be processed before the control values are populated

You should note that you only want to post back the values necessary for your callback in order to keep your payload as small as possible.  The Register function allows you to pass in any client-side id and it will loop its child controls and only post those values.  For example, you could have a DIV tag containing 3 textbox controls, by specifying the DIV tag’s client-side ID as the last parameter, those three textbox control values will be accessible in the callback.

You may recall, that the way the ClientAPI passes variables back and forth through its setVar/getVar functionality is with a HIDDEN FORM element.  Due to this, it is easy to only post this information for your callback.

mybutton.attributes.add("onclick", GetCallbackEventReference(Page, "'test'", "successFunc", "this", "errorFunc", DotNetNuke.UI.Utilities.ClientAPI.DNNVARIABLE_CONTROLID)

Note:  A constant has been defined within the ClientAPI namespace that represents this hidden variable (__dnnVariable).

If you have registered your callback script specifying the dnnVariable or the entire form you will be able to access your variables through the normal method

DotNetNuke.UI.Utilities.ClientAPI.GetClientVariable(Me.Page, "myvar")

Note: You will not be able to set any values and have them reflected on the client.


 
New Post
9/18/2006 10:53 AM
 

okay that makes sense BUT I tried this part

DotNetNuke.UI.Utilities.ClientAPI.DNNVARIABLE_CONTROLID and now I get a JS erro that Firefox seems to say is on line 159 of

Error: this.statusFunc is not a function
Source File: http://localhost/dnn_334/js/dnn.xmlhttp.js
Line: 159

Maybe I dont quite get the CONTROLID part correctly?


Dylan Barber http://www.braindice.com - Dotnetnuke development classes - skins and modules
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsClientAPIClientAPIDotNetNuke.UI.Utilities.ClientAPI.GetClientVariableDotNetNuke.UI.Utilities.ClientAPI.GetClientVariable


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