move from ajax pro to pagemethods

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
 
G

Gregory A. Beamer

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?
 
G

Gregory A. Beamer

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. ;-)
 
T

ton

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top