您的位置:首页 > 编程语言 > ASP

写了一个用AJAX(ASP.NET2.0)实现的DropDownList三级联动

2006-08-16 12:12 417 查看
执行的类:

public class AjaxMethod

调用的页面.CS

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using BITOC.Portal.Lib;

public partial class Employee_ChooseEmployee : PortalBasePage
<%@ Page Language="C#" EnableEventValidation="false" AutoEventWireup="true" CodeFile="ChooseEmployee.aspx.cs" Inherits="Employee_ChooseEmployee" %>

<!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>

<script type="text/javascript">

function DepartmentResult()

function get_Department_Result_CallBack(response)

function ItemResult()

function get_item_Result_CallBack(response)

function Check_Item()
</script>
</head>
<body onload="DepartmentResult();ItemResult();">
<form id="form1" runat="server">
<div>
<table style="height: 30px">
<tr>
<td style="width:100px;">
<asp:Literal ID="Literal1" runat="server">姓名</asp:Literal></td>
<td style="width:300px;">
<asp:TextBox ID="txtUserName" runat="server" Width="120px"></asp:TextBox>
  
<asp:CheckBox ID="chkAccord"
runat="server" Text="前端一致" /></td>
</tr>
</table>
</div>
<asp:Panel ID="Panel1" runat="server" Height="1px" Width="125px">
<table style="height: 30px">
<tr>
<td style="width:100px;">
<asp:Literal ID="Literal2" runat="server">公司/部?</asp:Literal></td>
<td style="width:400px;">
<asp:DropDownList ID="ddlCorp" runat="server" Width="240px" DataSourceID="ObjectDataSource1" DataTextField="NameChs" DataValueField="CompanyCd">
</asp:DropDownList>    
<asp:DropDownList ID="ddlDepartment" runat="server" Width="120px" DataSourceID="ObjectDataSource3" DataTextField="NameChs" DataValueField="DepartmentCd">
</asp:DropDownList>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OldValuesParameterFormatString="original_{0}"
SelectMethod="GetData" TypeName="ChooseEmployeeDSTableAdapters.CompaniesTableAdapter">
</asp:ObjectDataSource>
  
<asp:ObjectDataSource ID="ObjectDataSource3" runat="server" OldValuesParameterFormatString="original_{0}"
SelectMethod="Query" TypeName="ChooseEmployeeDSTableAdapters.DepartmentsTableAdapter" OnSelected="ObjectDataSource3_Selected">
</asp:ObjectDataSource>
</td>
</tr>
</table>
</asp:Panel>
<div style="height:30px">
<table style="height: 30px">
<tr>
<td style="width:100px;">
<asp:Literal ID="Literal3" runat="server">?目</asp:Literal></td>
<td style="width:300px;">
<asp:DropDownList ID="ddlItem" runat="server" Width="180px" DataSourceID="ObjectDataSource4" DataTextField="Name" DataValueField="ProjectCd">
</asp:DropDownList> 
<asp:ObjectDataSource ID="ObjectDataSource4" runat="server" OldValuesParameterFormatString="original_{0}"
SelectMethod="Query" TypeName="ChooseEmployeeDSTableAdapters.ProjectsTableAdapter">
</asp:ObjectDataSource>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: