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 ForumsClientAPIClientAPIClinet API Help (Fixed nevermind)Clinet API Help (Fixed nevermind)
Previous
 
Next
New Post
9/16/2006 4:29 AM
 

I followed the instructions in all the docs (at least I think) and I sort of have something working but have a problem with my reference

I use this to add to my linkbutton

Me.lbSubscribe.Attributes.Add("onclick", DotNetNuke.UI.Utilities.ClientAPI.GetCallbackEventReference(Me, "'test'", "successFunc", "'" & Me.lblSubscribe.ClientID.ToString & "'", "errorFunc"))

And this works up to a point

for testing I use this JS


<script>

function successFunc(result,ctx)

{

alert('recieved:' + result + '(' + ctx.id + ')');

//change pic here

}

function errorFunc(result,ctx)

{

alert('failed:' + result + '(' + ctx.id + ')');

}

</script>

however I never see ctx.id I always get an undefined - I asssume (unless I misread) that the ctx.id would be the clientid of the linkbutton - what might I be doing wrong here?


Dylan Barber http://www.braindice.com - Dotnetnuke development classes - skins and modules
 
New Post
9/16/2006 5:14 AM
 

Well I figured that one out but here is my problem now

 



<script>

function successFunc(result,ctx)

{

alert('recieved:' + result + '(' + ctx.id + ')');

alert(result);

document.getElementById(" + ctx.id + ").innerHTML = result;

}

function errorFunc(result,ctx)

{

alert('failed:' + result + '(' + ctx.id + ')');

}

</script>

my successFunc never changes the text of the element it gets - did I even write this correctly ?


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

I am not sure what you say was fixed and what you are now having problems with.  Are you getting your alerts?  If so what do they say?  Your original registering of the callback was using the clientid as the param, so I am not sure why you are using ctx.id now... should just be ctx.

Let me suggest downloading the HelloAJAX sample from the ClientAPI project downloads page.


 
New Post
9/18/2006 10:18 AM
 
Jon - sorry I figured out my problems - some of the documentation has ctx.id in it and that seems to work - is ctx an object of somekind is there other properties of it that we can access - not a big JS person so not quite sure how that might work.

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

Glad to hear you figured it out.

For clarification, your original post stated this as your callback registration

Me.lbSubscribe.Attributes.Add("onclick", DotNetNuke.UI.Utilities.ClientAPI.GetCallbackEventReference(Me, "'test'", "successFunc", "'" & Me.lblSubscribe.ClientID.ToString & "'", "errorFunc"))

You are specifying the lblSubscript.ClientID property (a string) as your context.  This is the value that will be associated to the ctx variable on the client.  The samples that the documentation includes is

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

which passes this as the context variable.  In this case it represents the object that triggered the event (mybutton).


 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsClientAPIClientAPIClinet API Help (Fixed nevermind)Clinet API Help (Fixed nevermind)


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