写了一个用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>
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>
相关文章推荐
- 用DropDownList实现Ajax无刷新省市三级联动中出现的错误
- AJAX无刷新实现三级联动并获取DropDownList的值的方法
- DropDownList用JQuery实现Ajax三级联动
- 用php和ajax写一个省市区的三级联动,实现地区的下拉选择
- AjaxPro 实现 三级联动菜单时,出现二级select 闪烁问题
- ajax实现dropdownlist与datagrid或Repeater无联动刷新
- ajax 实现三级联动功能
- Ajax实现省市县三级联动
- asp.net 使用jquery 和ajax 实现三级联动
- yii2中dropDownList实现二级和三级联动写法
- Ajax无刷新技术实现省市县三级联动下拉菜单--Asp.Net
- asp.net DropDownList 三级联动下拉菜单实现代码
- ajax+jsp实现三级联动下拉框
- AJAX+JSON 实现省市县地名三级联动
- ajax实现无刷新两级联动DropDownList
- jquery+ajax实现省市区三级联动效果简单示例
- 使用php+ajax实现三级联动
- 轻松实现无刷新三级联动菜单[VS2005和AjaxPro] (转)
- Hibernate+struts+JqueryAjax+jSON实现无刷新三级联动
- ajax实现无刷新两级联动DropDownList