/// <summary> /// 设置下拉框第一项 /// </summary> /// <param name="lst">数据源列表</param> private void SetFirstItem(List<dynamic> lst) { string sFlag = Request["flag"]; switch (sFlag) { case "0": lst.Insert(0, new { id = -999, text = "--全部--", selected = true }); break; case "1": lst.Insert(0, new { id = -999, text = "--请选择--", selected = true }); break; default: break; } } // 性别 public void BindGender() { List<dynamic> lst = new List<dynamic>(); lst.Add(new { id = 0, text = "未知" }); lst.Add(new { id = 1, text = "男" }); lst.Add(new { id = 2, text = "女" }); SetFirstItem(lst); Response.Write(JsonHelper.ToJson(lst)); }
时间: 2024-10-29 11:00:06