省市地区选择在各类项目中都可能要用到, 想要联动又刷新, 想只存地区代码又想显示方便, 还想要开发和部署简便...于是我的 DistrictDropDownList和 DistictLabel 应着全国人民的心声面世了 ^o^;; 这两个控件是本人2005年在公司开发一个网游交易网站时顺便做的. 在2006年试用Atlas时发现WebResource的好处后对控件做了改良.
DistrictDropDownList 的特点: 客户端使用JS+XML实现省市联动, 在IE6/5, FF2上测试通过.
DistrictDropDownList 和 DistictLabel 共同特点:
1. 主要属性是Code, Code是个Int32的值, 用于存储全国行政区划编号. 这样用1个变量(字段)就能存储省市(县)区3级别的信息.(区级用得少,所以这个版本没包含)
2. 行政区数据信息以XML格式嵌入在控件DLL中, 数据整理自中国国家统计局行政区划代码2006年12月31日版.
2. 在VS里即拖即用,呵呵
演示地址: http://efplatform.net/demo/webcontrols/districtcontrols.aspx
控件下载地址: http://www.cnblogs.com/Files/ericfine/EFPlatform.WebControls.rar
DistrictControls.aspx:
<% @ Register Assembly = " EFPlatform.WebControls " Namespace = " EFPlatform.WebControls " TagPrefix = " efp " %>
<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
< script runat ="server" >
protected void Page_Load(object sender, EventArgs e)
{
this .DistrictDropDownList2.Code = 430100 ;
this .DistrictDropDownList3.Code = 450500 ;
this .DistrictDropDownList4.Code = 210000 ;
}
protected void Button1_Click(object sender, EventArgs e)
{
this .DistrictLabel1.Code = this .DistrictDropDownList1.Code;
this .DistrictLabel2.Code = this .DistrictDropDownList2.Code;
this .DistrictLabel3.Code = this .DistrictDropDownList3.Code;
this .DistrictLabel4.Code = this .DistrictDropDownList4.Code;
}
</ script >
< html xmlns ="http://www.w3.org/1999/xhtml" >
< head runat ="server" >
< title > DistrictDropDownList & DistrictLabel Demo </ title >
</ head >
< body >
< form id ="form1" runat ="server" >
< div >
< efp:DistrictDropDownList ID ="DistrictDropDownList1" runat ="server" />
< br />
< efp:DistrictDropDownList ID ="DistrictDropDownList2" runat ="server" />
< br />
< efp:DistrictDropDownList ID ="DistrictDropDownList3" runat ="server" />
< br />
< efp:DistrictDropDownList ID ="DistrictDropDownList4" runat ="server" />
< asp:Button ID ="Button1" runat ="server" OnClick ="Button1_Click" Text ="Button" />< br />
< br />
< efp:DistrictLabel ID ="DistrictLabel1" runat ="server" >
</ efp:DistrictLabel >
< br />
< efp:DistrictLabel ID ="DistrictLabel2" runat ="server" >
</ efp:DistrictLabel >
< br />
< efp:DistrictLabel ID ="DistrictLabel3" runat ="server" >
</ efp:DistrictLabel >
< br />
< efp:DistrictLabel ID ="DistrictLabel4" runat ="server" >
</ efp:DistrictLabel >
</ div >
</ form >
</ body >
</ html >