private void BindListCate(int newsgroupID) { NewsCateBSO newsCateBSO = new NewsCateBSO(); DataTable table = newsCateBSO.GetNewsCateByNewsGroupID(newsgroupID); string strID = ""; if (table.Rows.Count > 0) { for (int i = 0; i < table.Rows.Count; i++) { DataRow row = table.Rows[i]; strID += row["CateNewsID"].ToString() + ","; } } if (strID != "") { lboCateSelect.Items.Clear(); CateNewsBSO catenewsBSO = new CateNewsBSO(); DataTable table1 = catenewsBSO.GetCateNewsBystrId(strID); if (table1.Rows.Count > 0) { for (int i = 0; i < table1.Rows.Count; i++) { DataRow row = table1.Rows[i]; lboCateSelect.Items.Add(new ListItem(row["CateNewsName"].ToString(), row["CateNewsID"].ToString())); } } } }
private void BindListCate(string _value) { if (_value != "") { lboCateSelect.Items.Clear(); _value = _value.Replace(" ", "").Trim(); _value = (!_value.Substring(_value.Length - 1, 1).Equals(",")) ? _value + "," : _value; CateNewsBSO catenewsBSO = new CateNewsBSO(); DataTable table = catenewsBSO.GetCateNewsBystrId(_value); if (table.Rows.Count > 0) { for (int i = 0; i < table.Rows.Count; i++) { DataRow row = table.Rows[i]; lboCateSelect.Items.Add(new ListItem(row["CateNewsName"].ToString(), row["CateNewsID"].ToString())); } } } }