Ironpython+anthem.net also play ajax!

Source: Internet
Author: User

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!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.