二三級下拉菜單
阿新 • • 發佈:2017-11-16
tab nbsp string exe table inf lis col pos
if (!Page.IsPostBack) { string sql = "select * from InfoType"; DataTable dt = SqlHelp.ExecuteDataTable(sql); string js = "",ss = ""; for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["parenttypeid"].ToString()=="") { js=dt.Rows[i]["typeid"].ToString(); DropDownList1.Items.Insert(i, new ListItem(dt.Rows[i]["tyepname"].ToString(), "")); } else { if (dt.Rows[i]["parenttypeid"].ToString()==js) { ss= "+"; } else { ss = "++"; } DropDownList1.Items.Insert(i, new ListItem(ss + dt.Rows[i]["tyepname"].ToString(), "")); } } }
二三級下拉菜單