这种写法的级联 难道就真不行吗 ?

Ooooonly 2011-10-25 10:29:01
数据库三张表
A省 B市 C区

A里面字段
id
pid
pname

B里面字段
id
cid
pid
cname

C里面字段
id
aid
aname
cid

 
省份
public static string aaa()
{
DataTable dt = new DataTable();
dt = TruckRules.TruckChinaProvinceRules.SelectChinaProvinceList();
StringBuilder st = new StringBuilder();
string F_ProvinceId = "";
st.Append("<option value=\"\">--请选择--</option>");
st.Append("<option value=\"\">全国</option>");
foreach (DataRow dr in dt.Rows)
{
st.Append("<option value=\"" + pid+ "\">" + dr["pname"] + "</option>");

}
return st.ToString();
}
城市
public static string sss(string pid)
{
DataTable dt = new DataTable();
dt = TruckRules.TruckChinaProvinceRules.SelectProvinceByCityPidFill(pid);
StringBuilder st = new StringBuilder();
st.Append("<option value=\"\">--请选择--</option>");
foreach (DataRow dr in dt.Rows)
{
st.Append("<option value=\"" + dr["cid"] + "\">" + dr["cname"] + "</option>");

}
return st.ToString();
}
区县
public static string rrr(string cid)
{
DataTable dt = new DataTable();
dt = TruckRules.TruckChinaProvinceRules.GetCityByAreasFill(cid);
StringBuilder st = new StringBuilder();
st.Append("<option value=\"\">--请选择--</option>");
foreach (DataRow dr in dt.Rows)
{
st.Append("<option value=\"" + dr["aid"] + "\">" + dr["aname"] + "</option>");

}
return st.ToString();
}

a.aspx.cs后台
aa = TruckFunction.TruckChinaCityFunction.aaa();
ss = TruckFunction.TruckChinaCityFunction.sss(pid);
rr = TruckFunction.TruckChinaCityFunction.rrr(cid);




<select id="selectP"><%=aa %></select>省
<select id="selectC"><%=ss %></select>市
<select id="selectA"><%=rr %></select>区/县



现在只能取到省份, 为什么点击省份不显示城市 我id传的不对还是写法不对啊 求指教 !

...全文
79 1 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
看不出来

28,409

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧