首页 新闻 会员 周边 捐助

dropdownlist绑定带有制表符的数据时变形

0
悬赏园豆:30 [已解决问题] 解决于 2009-09-25 08:49

想做成那种显示层次结构的下拉菜单,结果输入的制表符变得不整齐,保存成html文档打开就正常,下面是代码和图:

Code
问题补充: /// <summary> /// 绑定父级部门下拉菜单 /// </summary> private void bindFatherDepartment() { DataTable dt = creatDepartmentTable(); ddlFatherDepartment.DataSource = dt; ddlFatherDepartment.DataTextField = "DepartmentName"; ddlFatherDepartment.DataValueField = "DepartmentID"; ddlFatherDepartment.DataBind(); ddlFatherDepartment.Items.Insert(0, "请选择……"); dt.Dispose(); } /// <summary> /// 构造作为数据源的datatable /// </summary> /// <returns></returns> private DataTable creatDepartmentTable() { DepartmentsDS.DepartmentsDataTable result = new DepartmentsDS.DepartmentsDataTable(); DataSet DS = DBiz.getOrganizationList(); DataTable DT = DS.Tables[0]; for (int i = 0; i < DT.Rows.Count; i++) { result.Rows.Add(DT.Rows[i].ItemArray); creatFatherDepartmentTable1(result, DT.Rows[i]["DepartmentID"].ToString()); } DT.Dispose(); DS.Dispose(); return result; } /// <summary> /// 添加带线的数据行 /// </summary> /// <param name="target"></param> /// <param name="ID"></param> private void creatFatherDepartmentTable1(DataTable target,string ID) { DataSet DStemp = DBiz.getChildListByID(ID); DataTable DTtemp = DStemp.Tables[0]; for (int i = 0; i < DTtemp.Rows.Count; i++) { DataRow DR = DTtemp.Rows[i]; //构造DR内容 DataRow tempDR = DR; DataRow fatherDR = DBiz.getByID(tempDR["DepartmentSuperiorID"].ToString()).Tables[0].Rows[0]; for (int j = 0; j < (DR["DepartmentGUID"].ToString().Length/5 -1); j++) { if (j == 0) { if (Convert.ToI
于为源的主页 于为源 | 小虾三级 | 园豆:956
提问于:2009-09-23 15:43
< >
分享
最佳答案
0

如果你保存成html正常,多半是因为css不一致引起,修改dropdownlist样式,或建议你直接包装成一个自定义的drodownlist,将字符集的样式写死在最内层。

收获园豆:30
邀月 | 高人七级 |园豆:25475 | 2009-09-24 08:33
谢谢老师
于为源 | 园豆:956 (小虾三级) | 2009-09-25 08:48
呵呵·我不是老师,我也是学习者。
邀月 | 园豆:25475 (高人七级) | 2009-09-25 10:21
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册