<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Dialog2.aspx.cs" Inherits="WebApplication1.Dialog2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="easyUI/easyui.css" rel="stylesheet" type="text/css" />
    <link href="easyUI/icon.css" rel="stylesheet" type="text/css" />
    <script src="easyUI/jquery-1.4.4.min.js" type="text/javascript"></script>
    <script src="easyUI/jquery.easyui.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#dd").dialog({
                title: "测试",
                collapsible: true,
                minimizable: true,
                maximizable: true,
                resizable: true,
                toolbar: [{
                    text: "保存",
                    iconCls: "icon-add",
                    handler: function () {
                        $("#dd").dialog("open");
                        //data后面跟的参数可以用二种表式:一种是普通url传参的写法一样,还有一种就是写在json数组里,
                        //上面示例data部分也可以这样写:data: {name:"John",location:"Boston"}。
                        $.ajax({
                            url: "Handler.ashx",
                            type: "GET",
                            data: { name: $("#Text1").val(), pwd: $("#Text2").val() },
                            dataType: "text",
                            success: function (data) {
                                $.messager.show({
                                    title: "温馨提示",
                                    msg: data,
                                    timeout: 2000,
                                    showType: 'fade'
                                });
                                //$("#dd").dialog("close");
                            }
                        });
                    }
                },
            "-",
            {
                text: "删除",
                iconCls: "icon-save",
                handler: function () {
                    //$("#dd").dialog("close");
                    alert("del");
                }
            }],
                buttons: [
                {
                    text: "添加",
                    iconCls: "icon-add",
                    handler: function () { }
                }, { text: "删除",
                    iconCls: "icon-save",
                    handler: function () { }
                }],
                //事件
                onOpen: function () { alert("open"); },
                onClose: function () { alert("close") },
                onMinimize: function () { alert("minimize");}
            });
        });
    </script>
</head>
<body>
   <div id="dd" icon="icon-save" style="padding: 5px; width: 400px; height: 200px;">
    <div style="padding: 20px 20px 40px 80px;">
        <input id="Text1" type="text" />
        <input id="Text2" type="text" />         
     </div>
</div>
</body>
</html>
 

 

Handler.ashx

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace WebApplication1
{
    /// <summary>
    /// Summary description for TreeHandler
    /// </summary>
    public class TreeHandler : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string name=context.Request.Params["name"];
            string pwd = context.Request.Params["pwd"];
            if (name == "admin" && pwd == "admin")
            {
                context.Response.Write("Success");
            }
            else
            {
                context.Response.Write("Failed");
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}