AjaxControlToolkit 控件
新建服务 WebService
WebService.cs
using using using using using using using using using using using /// <summary> /// SNWebService 的摘要说明 /// </summary> WebService"http://tempuri.org/"WebServiceBindingWsiProfilesScriptService public class SNWebService WebService public //如果使用设计的组件,请取消注释以下行 //InitializeComponent(); /// <summary> /// 获取省份数据 /// </summary> /// <param name="knownCategoryValues"></param> /// <param name="category"></param> /// <returns></returns> WebMethodpublic CascadingDropDownNameValuestring string ListCascadingDropDownNameValuenew ListCascadingDropDownNameValuestring ConfigurationManager"ConnectionString"SqlConnection new SqlConnectionstring "Select * From Province"SqlCommand new SqlCommandSqlDataReader while new CascadingDropDownNameValue"Name""Code"return /// <summary> /// 获取市数据 /// </summary> /// <param name="knownCategoryValues"></param> /// <param name="category"></param> /// <returns></returns> WebMethodpublic CascadingDropDownNameValuestring string StringDictionary CascadingDropDownstring ConfigurationManager"ConnectionString"SqlConnection new SqlConnectionstring "Select * From city Where ProvinceId='" "Province""'"SqlCommand new SqlCommandSqlDataReader ListCascadingDropDownNameValuenew ListCascadingDropDownNameValuewhile new CascadingDropDownNameValue"Name""code"return /// <summary> /// 获取乡镇数据 /// </summary> /// <param name="knownCategoryValues"></param> /// <param name="category"></param> /// <returns></returns> WebMethodpublic CascadingDropDownNameValuestring string StringDictionary CascadingDropDownstring ConfigurationManager"ConnectionString"SqlConnection new SqlConnectionstring "Select * From area Where CityId='" "City""'"SqlCommand new SqlCommandSqlDataReader ListCascadingDropDownNameValuenew ListCascadingDropDownNameValuewhile new CascadingDropDownNameValue"Name""id"return
}
本文转自曾祥展博客园博客,原文链接:http://www.cnblogs.com/zengxiangzhan/archive/2009/11/06/1597484.html,如需转载请自行联系原作者