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 ForumsClientAPIClientAPIAJAX Page FlowAJAX Page Flow
Previous
 
Next
New Post
5/10/2006 11:49 PM
 

Hi Jon,
   I've read up on the ClientCallback API and ran the HelloAJAX sample.  I've implemented a simple ClientCallback API module.  I have one input textbox, one button, and one label.  I added the onClick attribute to kick start the AJAX, passing in the textbox client ID and the control clientid.  I was able to assign the text message from the textbox to the label control text.  The label control display the message and disappear since the page_load event take over and reset all the controls.  The question is, how can make this label control message that was processed to not disappear after the page_load event processed?  Your response is much appreciated. 

Tony Ngo  

 
New Post
5/11/2006 1:38 AM
 

Although I am not Jon, I would make this a client side control. (i.e. remove the runat=server).  This would guarantee that the server side would not overwrite anything. 

Another thing I would check is the property that you are setting?  I would try this:

dnn.dom.getById(ctx + '_myTextbox').value = “my textbox data”;

Regards,

Phebous...

 

 
New Post
5/11/2006 7:32 AM
 
Thanks Phebous, I am using DNN 4 and I did remove the runat server.  I still get a post back.  That what boggles my mind.
 
New Post
5/11/2006 10:12 AM
 

I am not sure I understand your scenerio exactly.  Let me post what I think you are saying and correct me if I am mistaken.

1)  You click the button which does a callback and retrieves a message

2) That message gets assigned to the label on the client.  Something like dnn.dom.getById('Label1').innerHTML = sMessage;

3) Some other control on the page does a postback and you loose the message that was assigned.

Is this correct?


If it is, then the reason you are loosing the message is that no where is the information being persisted.  If you had a control like a textbox that contained the message, then its contents would be posted to the server on a postback, and if it was a runat=server control the contents would automatically be placed back in the textbox when the page refreshed.  However, if you did not have a runat server the contents of the textbox would be set to whatever value is defaulted in your HTML. 

Since the contents of a label (SPAN) does not get posted back to the server there is no way for it to know the value, regardless of the runat attribute.  It is up to you to persist this value between postbacks.  This is what the setVar/getVar is all about.  If you are unfamiliar with this functionality I suggest reading the DotNetNuke ClientAPI Guide document.  Specifically the section titled Passing Data Between Server and Client.

Basically this would involve code that in addition to setting the innerHTML of the label, would also do a setvar on some unique ID.  On the server side (probably Page_Load or PreRender) I would check to see if a value exists in this field.  If one is found set the Label's Text property to it.  This of course assumes that the label has a RunAt server set.

Hopefully, my understanding of your problem was accurate and this info is helpful.  If not, please post more information so I can get a better understanding.

 

 


 
New Post
5/11/2006 9:14 PM
 
Thank you for you replies.  My problem was using server control in ASP.NET 2.0 and that do a postback by default which defeat the purpose.  I don't know how to set this to not do a post-back.  However, I found the solution by using a HtmlControl and set the runat=server.  Once I set the runat=server on the HTMLControl the code-behind pick up this control and I can add the "onClick" attribute of this control to kick off the ClientCallback. 
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsClientAPIClientAPIAJAX Page FlowAJAX Page Flow


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