<select name="newsclass" id="newsclass" > <%this.ResponseTypeTree(); %> </select>
public void ResponseTypeTree() { string sel = ""; DataSet ds = new DataSet(); ds = xjdata.GetNewsTypeDataSetByParentID("0"); dv = xjdata.GetNewsTypeDataSetByParentID().Tables[0].DefaultView; Response.Write("<option value=0 selected>选择类别</option>"); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { Response.Write("<option value=" + ds.Tables[0].Rows[i]["id"].ToString() + ">├" + ds.Tables[0].Rows[i]["name"].ToString() + "</option>"); this.GetChildType(ds.Tables[0].Rows[i]["id"].ToString(), ""); if (str != "") { Response.Write(str); str = ""; } } if (str != "") { Response.Write(str); } } private void GetChildType(string parentcode, string str1) { dv.RowFilter = "parentid='" + parentcode + "'"; dv.Sort = "orderid asc"; int a = dv.Count; string imgstr = ""; string sel = ""; imgstr = str1 + "?"; //if (dv.Count > 0) //{ // imgsrt = "<img src="images/folderHR.gif" mce_src="images/folderHR.gif" width=18 height=18>"; //} if (dv.Count == 0) return; for (int i = 0; i < a; i++) { str += "<option value=" + dv[i]["id"].ToString() + " >│" + imgstr + "└" + dv[i]["name"].ToString() + "</option> "; this.GetChildType(dv[i]["id"].ToString(), imgstr); dv.RowFilter = "parentid='" + parentcode + "'"; dv.Sort = "orderid asc"; } }
?