本帖最后由 郑丹丹1990 于 2013-4-24 08:59 编辑
asp.net基础视频中第一个:
省市县的联动- private List<AreaFull> xian()
- {
- AreaFull area =(AreaFull) cbCity.SelectedItem;
- int areaId = area.AreaPid;
- DataTable table = SqlHelper.DataTable("select * from AreaFull where AreaPid=@AreaId",
- new SqlParameter("AreaId", areaId));
- List<AreaFull> areas = new List<AreaFull>();
- for (int i = 0; i < table.Rows.Count; i++)
- {
- areas.Add(ToAreaFull(table.Rows[i]));
- }
- return areas;
- }
复制代码 开始我是把areaId写成cbCity.SelectedValue运行时错误:不存在从对象类型 wpf_ImportOrEmport.AreaFull 到已知的托管提供程序本机类型的映射。
但我写市的绑定时,就是采用获得省的SelectedValue,运行ok???? |