In the IronPython build project (also can be a mixed project with C #, see my previous post), you can use Anthem.net to easily implement Ajax functions.
Here's a simple example: on the page we put a Anthem text box and a button control, and when you click the button, you change the value in the text box with an asynchronous callback.
The code is simple:
Page ajax1.aspx:
<%@ Page Language="IronPython"CodeFile="ajax1.aspx.py" %>
<%@ Register Assembly="Anthem"TagPrefix="Anthem"Namespace="Anthem" %>
<!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd ">
<HTMLxmlns= "http://www.w3.org/1999/xhtml" >
<Headrunat= "Server">
<title>Ajax Examples of IronPython</title>
</Head>
<Body>
<formID= "Form1"runat= "Server">
<Div>
<Anthem:textboxID= "Txt1"runat= "Server" />
<Anthem:buttonID= "BTN1"runat= "Server"Text= "Test"Autocallback= "true"precallbackfunction=""OnClick= "Btn1_click" />
</Div>
</form>
</Body>
</HTML>
Background Code ajax1.aspx.py:
defBtn1_click (sender, args):
Txt1. Text=u"Chinese"
Txt1. Updateaftercallback=True
Demo Effect:
The example is very simple, but for the time being, it can be shown that the implementation of IronPython for ASP is limitless:)
In the above example, it should be noted that in the source code of IronPython, if the string contains Chinese, you need to use the U ' string ' way to represent, otherwise it will fail. And this code file needs to be saved in UTF-8 format.
Source: http://www.cnblogs.com/RChen/archive/2006/12/03/ipyajax1.html
Ironpython+anthem.net also play ajax!