This is a migrated thread and some comments may be shown as answers.

Setting the response for an Ajax request

1 Answer 70 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 05 Jun 2010, 10:38 PM
I have a very basic question about RadAjaxManager that I was unable to answer yet. How to pass data back to the client-side response handler:

Client-side, I might do something like this:

RadAjaxManager1.ajaxRequest(arg);

Server-side, I then do something like this:

protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
  string arg = e.Argument;
  // do something
}

Client-side, I then handle the response as so

function OnReponseEnd(sender, eventArgs)
{
}

My basic question is - how to pass data back to OnResponseEnd? What can I do server-side that will generate data that I can then process in OnResponseEnd? I'm more accustomed to doing ajax more bare-bones, like through jQuery, where I can pass params back and forth. I know I can add ResponseScripts server-side in order to pass data, but that's a bit clunky.

Thanks




1 Answer, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 10 Jun 2010, 08:47 AM
Hello Mike,

ResponseScripts is one option. Another is to update HTML content you can then check in OnResponseEnd. For example, you can update a hidden input on the server and get its value on the client after the response arrives. Yet another approach is to use ScriptManager.RegisterDataItem() to send a data item to a control on the client.

Greetings,
Veli
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Ajax
Asked by
Mike
Top achievements
Rank 1
Answers by
Veli
Telerik team
Share this question
or