您的位置:首页 > 其它

AJAX实现无刷新三联动下拉框

2006-08-14 16:09 447 查看
1、webconfig设置
(1)在system.web区添加:

<httpHandlers>
<add verb="*" path="*.ashx" type="AjaxPro.AjaxHandlerFactory,AjaxPro" />
</httpHandlers>

(2)在configuration区添加数据库连接字符串:

<add key="ConnectionString" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\Test\AjaxTest\DB\db.mdb;User ID='admin';" />

2、html代码:

<%@ Page language="c#" Codebehind="DropDownList.aspx.cs" AutoEventWireup="false" Inherits="AjaxTest.DropDownList" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>DropDownList</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<script language="javascript" type="text/javascript">
function cityResult()//城市
function callback_GetCityList( response )//回调
function areaResult()//县,区
function callback_GetAreaList( response )
function GetData()
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<P><asp:dropdownlist id="DropDownList1" runat="server" Width="150px"></asp:dropdownlist><br>
<asp:dropdownlist id="DropDownList2" runat="server" Width="150px"></asp:dropdownlist><br>
<asp:dropdownlist id="DropDownList3" runat="server" Width="150px"></asp:dropdownlist><br>
<br>
<INPUT type="button" value="显示所选数据" onclick="GetData();">
<asp:TextBox id="TextBox1" runat="server" Width="688px"></asp:TextBox></P>
<P>
<asp:Button id="Button1" runat="server" Text="Button"></asp:Button></P>
</form>
</body>
</HTML>

3、cs代码:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace AjaxTest

4、AjaxMethod方法类库:

using System;
using System.Data;
using System.Data.OleDb;

namespace AjaxTest

5、数据库文件:
/Files/wander/db.rar
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: