Click here to Skip to main content
15,892,059 members
Articles / Web Development / HTML

AJAX DropDownList

Rate me:
Please Sign up or sign in to vote.
4.63/5 (37 votes)
13 Jul 200510 min read 771.5K   13K   172  
Custom DropdownList that utilizes AJAX to populate its content and implements Observer pattern to participate in dependent dropdownlist chains.
<%@ Register TagPrefix="cc1" Namespace="CustomControls" Assembly="CustomControls" %>
<%@ Page language="c#" Codebehind="Default.aspx.cs" AutoEventWireup="false" Inherits="Demo.DefaultPage" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
  <head>
		<title>AjaxDropDownList Demo</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">
  </head>
	<body MS_POSITIONING="GridLayout">
		<form id="Form1" method="post" runat="server">
			<cc1:ajaxdropdownlist id="ddlCustomers" style="Z-INDEX: 101; LEFT: 136px; POSITION: absolute; TOP: 24px"
				runat="server" DataValueField="VALUE" DataTextField="TEXT" LookupName="Customer" Width="176px"></cc1:ajaxdropdownlist><asp:label id="lblCustomers" style="Z-INDEX: 103; LEFT: 24px; POSITION: absolute; TOP: 24px"
				runat="server" Width="88px">Customers</asp:label><asp:label id="lblOrders" style="Z-INDEX: 101; LEFT: 24px; POSITION: absolute; TOP: 56px" runat="server"
				Width="96px">Orders</asp:label><asp:label id="lblProducts" style="Z-INDEX: 102; LEFT: 24px; POSITION: absolute; TOP: 88px"
				runat="server" Width="96px">Products</asp:label><cc1:ajaxdropdownlist id="ddlOrders" style="Z-INDEX: 105; LEFT: 136px; POSITION: absolute; TOP: 56px"
				runat="server" DataValueField="VALUE" DataTextField="TEXT" LookupName="Order" Width="176px"></cc1:ajaxdropdownlist><cc1:ajaxdropdownlist id="ddlProducts" style="Z-INDEX: 106; LEFT: 136px; POSITION: absolute; TOP: 88px"
				runat="server" DataValueField="VALUE" DataTextField="TEXT" LookupName="Product" Width="176px"></cc1:ajaxdropdownlist><asp:label id="lblCustomersResult" style="Z-INDEX: 104; LEFT: 432px; POSITION: absolute; TOP: 24px"
				runat="server"></asp:label><asp:label id="lblOrdersResult" style="Z-INDEX: 105; LEFT: 432px; POSITION: absolute; TOP: 56px"
				runat="server"></asp:label><asp:label id="lblProductsResult" style="Z-INDEX: 106; LEFT: 432px; POSITION: absolute; TOP: 88px"
				runat="server"></asp:label><asp:button id="btnSubmit" style="Z-INDEX: 107; LEFT: 16px; POSITION: absolute; TOP: 120px"
				runat="server" Text="Submit"></asp:button>
		</form></FORM>
	</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Singapore Singapore
Currently, he is in Singapore doing a contract work for a multinational company. During weekend, he is busy exploring Singapore with his lovely fiance to find the best food.

Comments and Discussions