Sunday, March 11, 2012

Dear GODS OF AJAXS, can you freaking help me i am going crazy here

hello.

even though i'm not an ajax god, i'll give it a shot...

currently, there's no way to achieve this in ASP.NET. I'm assuming that you're wanting to have access to the page from within the ObjMoved method on the server, right? if so, then you might want to take a look at another ajax platform. I think it might let you do something like that (ie, it'll let you call a server page method from within client js code):

http://www.ajaxpro.info/


Hi Luis,

thank you for your reply, i am not trying to have access to the page, well kind of, but really what i am trying to do is to raise an event that i can capture on server side, think of it this way this is what i am trying to achive

add a script manager and update panel to a aspx page, put a simple button there with onclick event defined something like this

1<%@. Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
23<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
45<html xmlns="http://www.w3.org/1999/xhtml" >
6<head runat="server">
7 <title>Untitled Page</title>
8</head>
9<body>
10 <form id="form1" runat="server">
11 <div>
12 <asp:ScriptManager ID="ScriptManager1" runat="server">
13 </asp:ScriptManager>
14
15 </div>
16 <asp:UpdatePanel ID="UpdatePanel1" runat="server">
17 <ContentTemplate>
18 <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
19 </ContentTemplate>
20 </asp:UpdatePanel>
21 </form>
22</body>
23</html>
24

. when you run the page if you click on the button you can actually put a break the following method Acronymsly

protected void Button1_Click(object sender, EventArgs e) {
//Do something here
}

that is an example and click event being raised and captured on server side

is that more clear on what i am trying to achieve here, i am just trying to create my own event and raise it from javascript before ms ajax was out the proper method was to use __DoCallBack, i just wanne do how you do this with ma ajax

Thanks,


Hello.

well, if you're talking about the ICallbackEventHandler, i believe that it's still suported in ASP.NET AJAX pages (though I personally haven't used it). Even though i could be wrong, i think that the toolkit control has at least one extender (the rating control) that uses the interface to perform that kinf of client/server communication...


That is actually a big help i see ICallbackEventHandler still needs to be used i was under impression that IScriptControl would be able to handle CallBackevent handlers as well, but seems like i was wrong.

Thank you

p.s if anyone knows a way and would like to share it with us go ahead please :)


Page methods are a great way to do that.


hello.

well, didn'tmentioned it because i still don't knwo what's the "//do something" means :)


oh, and ScriptControl is a class you can use as base if you're uilding a script control. a script control is a server control that will let you insert script references and script descriptors on a page. these are normally translatted into $create expressions which are inserted into your page (most of the time, you'l be wrapping html controls with client side AJAX controls and the code for making that "wrap" is inserted dynamically on the page by your server control). It's important to notice that these controls aren't really capable of performing async communication with the server side (though you can make them to that by, for instance, using the interface we were speaking about before)

No comments:

Post a Comment