PDA

View Full Version : PageMethod in coolite



Jurke
Oct 30, 2008, 11:37 AM
Hi
Is there anything similar to PageMethods (AjaxToolkit) in the Coolite? With pagemetod you can call a webservice function from javascript. You are probably familiar with the concept.





<asp:ScriptManager ID="ScriptManager2" runat="server" EnablePageMethods="true"/>




[System.Web.Services.WebMethod]
public static string GetSQLData()
{
****
}



JAVASCRIPT
call to the GetSQLData()
//--


Best regards
Mikael Jürke

Rod
Oct 30, 2008, 11:55 AM
Hello.
You should have a look at the AjaxEvents in the example explorer. i guess that will do it :)
There was also a few topics about them where geoff/vlad said interesting stuff about AjaxEvents in the forum that you can easily find.

Jurke
Oct 30, 2008, 12:03 PM
Hi
AjaxEvent is a CodeBehind event. I need to call a code behind function from Java script? I cant find anything on that on the forum.

Best regards
Mikael Jürke

Rod
Oct 30, 2008, 12:11 PM
Ok sry, I see what u mean now.
I think I saw something posted by Geoff about that for the nxt version, i'll try to find it. I might be completely wrong tho :/

edit :
Would that work for you?
http://forums.ext.net/showthread.php?threadid=3269-4-1.aspx

Jurke
Oct 30, 2008, 12:30 PM
Yes you are right!
Im to bad at searching it turns out :)

But is it possible to call a function that is not connected to a button, I also need to have input parameters to the funtion like the pagemetods?

Best regards
Mikael Jürke

Rod
Oct 30, 2008, 12:38 PM
You can define customAjaxEvents within your scriptmanager (and within scriptmanagerproxy with the next release). i think you can then specifically call your method from wherever you want within your script like a page method.
Check if you need to specify a target or not.
Other than that I dn't see any way to achieve what you want, but I'm not qualified enough to tell you it's not possible.

edit :
U slighlty modified ur answer, therefore mine isnt rly coherent with ur question now :p
I dnt know how u can specifically pass arguments to an ajax event (but i'm interested in it), but that's certainly possible.
Need an answer from someone competent :p

Jurke
Oct 30, 2008, 12:44 PM
Thanks! will wait for the experts to awnser then :)

/Mikael

Jurke
Nov 02, 2008, 9:13 AM
Vladsh or geoff? I would really like you opinion on this one. If its not possible to call a codebehind function from javascript with input parameters and a return value. Im forced to do it with the worthless Ajax Toolkit.

Best regards
Mikael Jürke

geoffrey.mcgill
Nov 02, 2008, 1:12 PM
Hi Mikael,

We're working on another feature called [AjaxMethod] and should be able to post some code samples tomorrow.


If you poke around the Sandbox project you might be able to see a small sample of what we're working on, although expect that code/syntax to change within the next 24 hours.*

Jurke
Nov 03, 2008, 3:09 AM
Thanks geoff! can you please update this thread when its ready?

/Mikael

Rod
Nov 03, 2008, 3:49 AM
Isnt this name already used in MagicAjax? It could be confusing (tho its really suited here :()

Jurke
Nov 05, 2008, 4:25 AM
Is there anythig ready to try out yet? with the new syntax i mean?

/Mikael