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 ForumsClientAPIClientAPI Getting updated hidden input values via callback event Getting updated hidden input values via callback event
Previous
 
Next
New Post
2/27/2006 10:50 AM
 
Bascially I have a hidden input field which contains a page number for a list view. When clicking on next or previous a xmlhttprequest is invoked and the requested page of data is rendered and I update the hidden input fields value with the new page. Now, the next time they hit next/previous the xmlhttprequest is invoked, and I need to grab the updated value serverside to use to populate the requested page. Since no postback occours during this the value I obtain via server side logic is still the old value. My question is this; how can I get the updated clientside value of the hidden input from my server code since it is never posted back. Thanks a lot for any help.
 
New Post
2/27/2006 11:05 AM
 

The only updated state information passed to the server is contained within the callback.  Thus you will need to pass any values you need in the single argument of the callback (delimited by some known character).  In the serverside code simply parse the single argument out into multiple ones.

Hopefully it is also obvious that any state information written during a callback will also not be persisted in the page, since it is not re-rendered.  Note:  this excludes Session state which would work if you chose to use it.


 
New Post
2/27/2006 11:15 AM
 
I do understand what your saying, and it was intentional that I have avoided using state to store said variable. The part I am not quite clear on is this.

Thus you will need to pass any values you need in the single argument of the callback (delimited by some known character).

I assume your saying when adding the callback atribute to the control and setting the Argument, but I'm not sure how to do that in application. Would you write me alittle one liner to illustrate your point.

                this.cmdNext.Attributes.Add("onclick", ClientAPI.GetCallbackEventReference(this, "dnn.dom.getById('" + this.NSNext.ClientID + "').value", "nsNextSuccessFunc", "this", "nsNextErrorFunc"));

is what I have now. the additonal client control I want to grab the value for during the callback event is

   <input id="NSPage" type="hidden" runat="server" value="1" contenteditable="true" />

I am just not sure how to add that to the above assignment. I have tried a few different ways with no luck thus far. Thanks for your patience with me.



 
New Post
2/27/2006 11:30 AM
 

You could concatenate things directly like this...

this.cmdNext.Attributes.Add("onclick", ClientAPI.GetCallbackEventReference(this, "dnn.dom.getById('" + this.NSNext.ClientID + "').value + '~' + dnn.dom.getById('" + this.NSPage.ClientID + "').value", "nsNextSuccessFunc", "this", "nsNextErrorFunc"));

But I would probably code it like this...

this.cmdNext.Attributes.Add("onclick", ClientAPI.GetCallbackEventReference(this, "mynicefunctionnamehere()", "nsNextSuccessFunc", "this", "nsNextErrorFunc"));

and somewhere in the page (or separate js file) define

function mynicefunctionnamehere()
{
  return dnn.dom.getById('" + this.NSNext.ClientID + "').value + '~' + dnn.dom.getById('" + this.NSPage.ClientID + "').value;",
}

On the serverside you would parse the argument (i.e. arg.split("~"))

Note:  If you are unsure that the tilda (~) is a safe character you can use my predefined character for delimiting the string...

function mynicefunctionnamehere()
{
  return dnn.dom.getById('" + this.NSNext.ClientID + "').value + COL_DELIMITER + dnn.dom.getById('" + this.NSPage.ClientID + "').value;",
}

on the serverside the delimiter is found in the clientapi namespace.

arg.split(ClientAPI.COLUMN_DELIMITER)

 


 
New Post
2/27/2006 11:32 AM
 
Thank you so much for your help, that makes it much clearer to me!
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsClientAPIClientAPI Getting updated hidden input values via callback event Getting updated hidden input values via callback event


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