private void setNewKind() { string strNewsKind = ""; if (!string.IsNullOrEmpty(MDS.Utility.NUtility.trimBad(Request.QueryString["_selNewsKind"]))) { strNewsKind = MDS.Utility.NUtility.trimBad(Request.QueryString["_selNewsKind"]); } List <CodeVo> codeVoList = MIPCodesUtil.getCodeListByLevel("A"); _selNewsKind.Items.Clear(); //設定商品類別 _selNewsKind.Items.Add(new ListItem("全部", "")); foreach (CodeVo codeVo in codeVoList) { string codeVo_name = MDS.Utility.NUtility.HtmlEncode(MDS.Utility.NUtility.trimBad(codeVo.name)); string codeVo_key = MDS.Utility.NUtility.HtmlEncode(MDS.Utility.NUtility.trimBad(codeVo.key)); if (strNewsKind != null && !strNewsKind.Equals("")) { if (strNewsKind.Equals(codeVo.key)) { ListItem listItem = new ListItem(codeVo_name, codeVo_key); listItem.Selected = true; _selNewsKind.Items.Add(listItem); } else { _selNewsKind.Items.Add(new ListItem(codeVo_name, codeVo_key)); } } else { _selNewsKind.Items.Add(new ListItem(codeVo_name, codeVo_key)); } } }
private void selectDataClass() { List <CodeVo> codeVoList = MIPCodesUtil.getCodeListByLevel(str_dlDataType); //設定商品類別 foreach (CodeVo codeVo in codeVoList) { string codeVo_name = MDS.Utility.NUtility.HtmlEncode(MDS.Utility.NUtility.trimBad(codeVo.name)); string codeVo_key = MDS.Utility.NUtility.HtmlEncode(MDS.Utility.NUtility.trimBad(codeVo.key)); if (codeVo.key.Equals(str_dlDataClass)) { ListItem oListItem = new ListItem(codeVo_name, codeVo_key); oListItem.Selected = true; _dlDataClass.Items.Add(oListItem); } else { _dlDataClass.Items.Add(new ListItem(codeVo_name, codeVo_key)); } } }