Cascading DropDownLists With ASP.NET and jQuery
Cascading drop down lists is a really nice feature for web developers. I thought it was time to write an article on how to do this using ASP.NET and jQuery. Well here’s one way of doing it. Before we get started, this example uses the latest version of jQuery which is 1.3.2. That can be downloaded from here.
Open Visual Studio 2008 and create a new Web Application. For this article I’m not going to connect to a database. I’ve created two classes, Employee and EmployeeCars, which will store the data. Create two new classes and add the following code:
C#
public class Employee
{
public int Id { get; set; }
public string GivenName { get; set; }
public string Surname { get; set; }
public List<Employee> FetchEmployees()
{
return new List<Employee>
{
new Employee {Id = 1, GivenName = "Tom", Surname = "Hanks"},
new Employee {Id = 2, GivenName = "Tiger", Surname = "Woods"},
&nb
Ïà¹ØÎĵµ£º
Õª³Ç°±²ÃǵÄ
ÆäʵҪʵÏÖÕâ¸ö¹¦ÄÜÖ÷Òª»¹ÊÇÒªÓõ½javascript
·½·¨Ò»£º
ÔÚasp.netµÄaspxÀïÃæµÄÔ´´úÂëÖÐ
<input type="button onclick="javascript:window.history.go(-1);"value="·µ»ØÉÏÒ»Ò³">
dzÎö£ºÕâ¸öÊÇÓÃÁËHTML¿Ø¼þ£¬Í¨¹ýÒ»¸öonclickµÄʼþ£¬µ÷ÓÃÁËjavascriptÖеÄÒ»¸ö·½·¨¾Í¿ÉÒÔÁË¡£Õâ¸öÊÇ×î¼òµ¥µÄÁË£¬Ò²Í¬Ñù ......
²½Öè1£º
ÐÞ¸Äwin2003ÉÏ´«ÏÞÖÆ£¬ÕÒµ½windows\system32\inserv\metabase.xmlÎļþ
½«ÆäÖеġ¡aspmaxrequestentityallowed= µÄÖµ¸ÄΪ1073741824¡¡£¨1G£©
×¢ÒâÐÞ¸ÄǰҪֹͣIISµÈ·þÎñ¡£
²½Öè2£º
Èç¹ûÄã×°µÄÊÇnet1.1£¬ÇëÕÒµ½windows\...\v1.1.4322\config\machina.configÎļþ£¬½«execution timeout¸ÄΪ36000
½ ......
ÉèÖÃ×é¼þ
<configSections>
<section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter"/>
</configSections>
ÉèÖÃÄ£¿é
<httpModules>
&n ......
ÉÏÆªÎÄÕÂÖÐ˵µ½Ê²Ã´ÊÇ Cache¶ÔÏó£¬ÈçºÎÔÚASP.NETÖÐʹÓà Cache¶ÔÏó¡£ÏÂÃæÎÒÃÇÀ´ËµËµÈçºÎÔÚASP.NETÖÐɾ³ýÏî¡£
ASP.NET Cache ¶ÔÏóÉè¼ÆÓÃÓÚ±£Ö¤Ëü²¢²»Ê¹Óùý¶àµÄ·þÎñÆ÷ÄÚ´æ¡£½á¹ûÊÇ£¬µ±ÓÃÄÚ´æ±äµÃȱ·¦Ê±£¬Cache¶ÔÏó×Ô¶¯É¾³ý×îÉÙ±»Ê¹ÓõÄÏî¡£Äã¿ÉÒÔͨ¹ý¶¨Òåʱ¼äÏÞÖÆ¡¢ÒÀÀµÏî¡¢ÒÔ¼°Ïî
ÔÚCache¶ÔÏóÖеÄÓÅÏȼ¶À´Ó°Ïì Cache¶ÔÏó±£ ......
aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ArticlePage.aspx.cs" Inherits="ArticlePage" %>
<!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" > ......