move from ajax pro to pagemethods

  • Thread starter Thread starter ton
  • Start date Start date
T

ton

Hi,

I'm currently working with AjaxPro to pass serverside information to the
clientscript. I'm using Ajax Pro, which works fine. The problem is that it
would not be supported in the near future, since Ajax is enabled for using
pagemethods.

The problem however is that I want to return a datatable. This works fine in
Ajaxpro, but I can't have it working in Ajax pagemethods

I'm using VS2005.

Does this sounds familiar or can it be solved, or is it solved in VS2008 ?

btw I'm using VB


Thanx

ton
 
I have not used AjaxPro. I would cull through Michael's blog, as he would be
the best source:
http://weblogs.asp.net/mschwarz

I don't understand the issue with returning a DataTable, however. What
exactly are you trying to do with the DataTable and how are you working with
ASP.NET AJAX?

--
Gregory A. Beamer
MVP: MCP: +I, SE, SD, DBA

Blog:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think Outside the Box! |
********************************************
 
Good article, but this can be done with ASP.NET AJAX and some client side
JavaScript. Having not used AjaxPro, it is possible there was a library to
simplify this, but the client side of AJAX is all JavaScript.

If AjaxPro has JavaScript libs that can take JSON data and make a table on
the client, then the OP can rip the files and use them with ASP.NET AJAX.
Currently, MS does not have the best JSON story, but it is getting better.
Worst case is opting for JQuery?

I see software as a set of contracts and boundaries. The contract details
what you send and what you get back. The boundary is just what you are
calling. With some boundaries, you end up with more rules (ala, postback,
AJAX, etc.), but you are simply fulfilling the contract over a particular
protocol, etc. One problem with MS's direction, is it is blurring the
plumping and creating a mysterious mass of drag and drop. This is fine until
someone gets outside the box and can't find his way home. ;-)

--
Gregory A. Beamer
MVP: MCP: +I, SE, SD, DBA

Blog:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think Outside the Box! |
********************************************
 
This is how its done with AjaxPro:

In Javascrip:
function laadcombo(combo,shortname) {
Compass.FillCombo(shortname, Laadcombo_CallBack);
}

function Laadcombo_CallBack(resp) {
var response=resp;
if (response.error != null)
{ alert(response.error);
bwait=false;
return; }
var artikels = response.value;
if (artikels == null || typeof(artikels) != "object") return;
for (var i = 0; i < artikels.Rows.length; ++i)
if (xcombo.value!=artikels.Rows.ID)
xcombo.options[xcombo.options.length] = new
Option(artikels.Rows.Identification, artikels.Rows.ID);
}

Very straightforward and the result a datatable can be used to update the
dropdownlist. In VB there are 2 procedures:
In thePage_Load event:
AjaxPro.Utility.RegisterTypeForAjax(GetType(Compass)) where Compass is the
Class name

and the procedure to load the datatable:
<AjaxPro.AjaxMethod()> Public Function FillCombo(ByVal parameter As
String) As System.Data.DataTable
Dim x = Split(parameter)
With ses 'Ses is an .NET object who's GetXX method returns and
ADO.NET datatable
x(1) = Replace(x(1), "^", " ") & ""
If Val(x(2)) = 0 Then
If Val(x(0)) = 2 Then
Return ses.GetFilters(x(1)).DataTbl
ElseIf x(0) = 4 Then
Return ses.GetWizards(x(1)).DataTbl
Else
Return ses.GetCodelist(Val(x(0)), , , ,
x(1)).DataTbl
End If
Else
Return ses.GetCodelist(Val(x(0)), , x(2), x(3),
x(1)).DataTbl
End If
End With
End Function

I've rebuilded these procedure and can use PageMethods but the datatable can
not be recognised. It does work, but only as a string return type.

thanx

Ton
 
Back
Top