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

Client-side binding, how to get raw AJAX response object?

3 Answers 173 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 23 Mar 2012, 03:15 PM
I'm using client-side binding to a WebMethod, and I need to intercept the AJAX response object. I can get the row objects that are children of the response in the OnRowDataBound through args.get_dataItem(); how to do I get the return object from the WebMethod (either before or after the grid is bound at client-side)?

3 Answers, 1 is accepted

Sort by
0
Antonio Stoilkov
Telerik team
answered on 28 Mar 2012, 09:22 AM
Hi Jason,

You could take a look at the OnDataBinding and OnDataSourceResolved client events and its argument properties described in the help articles below. We wrap the AJAX response object and provide related data in these events. We do not directly expose the raw AJAX response object.

Greetings,
Antonio Stoilkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Jason
Top achievements
Rank 1
answered on 28 Mar 2012, 05:45 PM
So if my webmethod returns the following object, I can only get at the "Data" property, and I have no way of accessing the "IsError" or "ErrorMessage" properties?

public class FlattenedReportResult<T>
{
   public int Count { get; set; }
   public List<T> Data { get; set; }
   public bool IsError { get; set; }
  
public string ErrorMessage { get; set; }
}
0
Antonio Stoilkov
Telerik team
answered on 02 Apr 2012, 09:02 AM
Hello Jason,

You could achieve your scenario but it is not trivial implementation. The idea is to manually bind the grid by creating your own ajax request using jQuery ajax function. I have provided a demo for the client-side binding of RadGrid and an article covering ajax usage.

Kind regards,
Antonio Stoilkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Jason
Top achievements
Rank 1
Answers by
Antonio Stoilkov
Telerik team
Jason
Top achievements
Rank 1
Share this question
or