/// <summary> /// 绑定下拉框数据 /// </summary> /// <param name="dt">所要绑定数据源DataTable</param> /// <param name="dropDownList">界面控件下拉框</param> /// <param name="textField">显示字段</param> /// <param name="valueField">值字段</param> public void BindDropDownList(DataTable dt, ExtAspNet.DropDownList dropDownList, string textField, string valueField) { dropDownList.DataSource = dt; dropDownList.DataTextField = textField; dropDownList.DataValueField = valueField; dropDownList.DataBind(); }
public void BindDDL(ExtAspNet.DropDownList ddl, string value, string text, DataTable data) { ddl.DataValueField = value; ddl.DataTextField = text; ddl.DataSource = data; ddl.DataBind(); }
/// <summary>按分点绑定体检单位 /// /// </summary> /// <param name="dropDictcustomer">体检单位下拉控件</param> /// <param name="dictlabid">分点ID</param> /// <param name="isAddAll">是否增加全部选项true增加 false不增加 </param> public void DropDictcustomerBinder(ExtAspNet.DropDownList dropDictcustomer, string dictLabId, bool isAddAll, string Customertype = "0") { LoginService loginservice = new LoginService(); if (dictLabId == "-1") //全部 { List <Dictcustomer> CustomerList = loginservice.GetDictcustomer(); List <Dictlab> dictList = loginservice.GetPermissionDictlab(Userinfo); List <Dictcustomer> dictcustomerback = new List <Dictcustomer>(); foreach (Dictlab dict in dictList) { List <Dictcustomer> dictcustomerfirt = CustomerList.FindAll(c => (c.Dictlabid == dict.Dictlabid && c.Customertype == Customertype && c.Active == "1") || (c.IsPublic == "1" && c.Active == "1")); foreach (Dictcustomer dictcust in dictcustomerfirt) { if (!dictcustomerback.Contains(dictcust)) { dictcustomerback.Add(dictcust); } } } dropDictcustomer.DataSource = dictcustomerback; } else { dropDictcustomer.DataSource = loginservice.GetDictcustomer().FindAll(c => (c.Dictlabid == double.Parse(dictLabId) && c.Customertype == Customertype && c.Active == "1") || (c.IsPublic == "1" && c.Active == "1")); } dropDictcustomer.DataValueField = "Dictcustomerid"; dropDictcustomer.DataTextField = "Customername"; dropDictcustomer.DataBind(); if (isAddAll) { dropDictcustomer.Items.Insert(0, new ExtAspNet.ListItem("全部", "-1")); } }
/// <summary> /// 绑定省 /// </summary> /// <param name="dpProvince"></param> public void DropProvinceBinder(ExtAspNet.DropDownList dpProvince) { dpProvince.Items.Clear(); dpProvince.DataSource = SHENG_JSON; dpProvince.DataBind(); dpProvince.Items.Insert(0, new ExtAspNet.ListItem("选择省份", "-1")); }
/// <summary>基本资料下拉绑定通用方法 /// /// </summary> /// <param name="ddllst">下拉控件名称</param> /// <param name="type">基本资料类别,如SEX</param> public void DDLInitbasicBinder(ExtAspNet.DropDownList ddllst, string type) { ddllst.DataSource = new LoginService().GetLoginInitbasicList().FindAll(c => c.Basictype == type); ddllst.DataTextField = "Basicname"; ddllst.DataValueField = "Basicvalue"; ddllst.DataBind(); }
/// <summary>基础字典下拉绑定通用方法 /// /// </summary> /// <param name="ddllst">下拉控件名称</param> /// <param name="type">基础字典代码</param> public void DDLLabraryItemBinder(ExtAspNet.DropDownList ddllst, string type) { ddllst.DataSource = new LoginService().GetLoginDictlibraryitemList().FindAll(c => c.Librarycode == type); ddllst.DataTextField = "Itemname"; ddllst.DataValueField = "Dictlibraryitemid"; ddllst.DataBind(); }
/// <summary> /// 绑定下拉框数据 /// </summary> /// <param name="data"></param> /// <param name="ddl"></param> public void BindDDL(DataTable data, ExtAspNet.DropDownList ddl) { ddl.DataSource = data; ddl.DataTextField = "NAME"; ddl.DataValueField = "CODE"; ddl.DataBind(); }
/// <summary> /// 绑定下拉框 /// </summary> /// <param name="down">下拉框ID</param> /// <param name="dtData">数据源</param> /// <param name="textField">显示字段</param> /// <param name="valueField">值字段</param> void BindDropDown(DataTable dtData, ExtAspNet.DropDownList down) { down.DataSource = dtData; down.DataTextField = "NAME"; down.DataValueField = "CODE"; down.DataBind(); }
public void ExeBindCheckResult(DataTable dtCheckResult) { ExtAspNet.DropDownList DdcheckResult = new ExtAspNet.DropDownList(); DdcheckResult.ID = "DdcheckResult1"; DdcheckResult.AutoPostBack = true; DdcheckResult.Label = "检查结果"; for (int i = 0; i < dtCheckResult.Rows.Count; i++) { DdcheckResult.Items.Add(new ExtAspNet.ListItem(dtCheckResult.Rows[i]["NAME"].ToString(), dtCheckResult.Rows[i]["CODE"].ToString())); } row_CheckResult.Items.Add(DdcheckResult); }
/// <summary> /// 绑定县 /// </summary> /// <param name="dpCity"></param> /// <param name="dpCounty"></param> public void DropCountyBinder(ExtAspNet.DropDownList dpCity, ExtAspNet.DropDownList dpCounty) { dpCounty.Items.Clear(); string city = dpCity.SelectedValue.ToString(); if (city != "-1") { JArray county = XIAN_JSON.Value <JArray>(city); dpCounty.DataSource = county; dpCounty.DataBind(); } dpCounty.Items.Insert(0, new ExtAspNet.ListItem("选择县", "-1")); }
/// <summary> /// 绑定市 /// </summary> /// <param name="dpProvince"></param> /// <param name="dpCity"></param> public void DropCityBinder(ExtAspNet.DropDownList dpProvince, ExtAspNet.DropDownList dpCity) { dpCity.Items.Clear(); string province = dpProvince.SelectedValue.ToString(); if (province != "-1") { JArray city = SHI_JSON.Value <JArray>(province); dpCity.DataSource = city; dpCity.DataBind(); } dpCity.Items.Insert(0, new ExtAspNet.ListItem("选择市", "-1")); }
//下拉列表绑定复合列 private void BindDropdownList(ExtAspNet.DropDownList dp, List <Dicttestitem> list) { if (list == null || list.Count == 0) { return; } List <CustomClass> myList = new List <CustomClass>(); foreach (Dicttestitem item in list) { myList.Add(new CustomClass(item.Dicttestitemid, "[" + item.Testcode + "]" + item.Testname)); } dp.DataSource = myList; dp.DataTextField = "Name"; dp.DataValueField = "ID"; dp.DataBind(); dp.Items.Insert(0, new ExtAspNet.ListItem("请选择", "-1")); }
/// <summary>绑定分点下拉框,并选中默认项 /// /// </summary> /// <param name="ddllst">下拉控件名称</param> /// <param name="ddllst">是否取权限过滤后结果</param> public void DDLDictLabBinder(ExtAspNet.DropDownList ddllst, bool isPermission) { if (Userinfo != null) { List <Dictlab> lablist = new List <Dictlab>(); if (isPermission) { lablist = new LoginService().GetPermissionDictlab(Userinfo); } else { lablist = new LoginService().GetLoginDictlab(); } ddllst.DataSource = lablist; ddllst.DataTextField = "Labname"; ddllst.DataValueField = "Dictlabid"; ddllst.DataBind(); //有默认分点则选择默认分点 if (Userinfo.dictlabid != null) { ddllst.SelectedValue = Userinfo.dictlabid.ToString(); } } }
private void SaveCheck() { exeCheckArgs.UnitID = Convert.ToInt64(Session["UnitID"]); exeCheckArgs.UnitName = Session["UnitName"].ToString(); exeCheckArgs.TempID = Convert.ToInt64(Session["ExeTempID"]); exeCheckArgs.TempName = txt_Tmp.Text; //Session["SelectedTemplateNameExeCheck"].ToString(); exeCheckArgs.IsLicence = Convert.ToChar(ddl_wuzheng.SelectedValue); exeCheckArgs.IsFiling = Convert.ToChar(ddl_jiandang.SelectedValue); exeCheckArgs.StartDateTime = Convert.ToDateTime(dp_start.Text); exeCheckArgs.End_DateTime = Convert.ToDateTime(dp_end.Text); exeCheckArgs.CheckPoint = txt_address.Text; exeCheckArgs.IsRectification = Convert.ToChar(ddl_zhenggai.SelectedValue); if (ddl_zhenggai.SelectedValue == "1") { exeCheckArgs.Review = Convert.ToDateTime(dp_fucha.Text); } else { exeCheckArgs.Review = Convert.ToDateTime("0001-01-01"); } exeCheckArgs.IsReview = Convert.ToChar(ddl_fucha.SelectedValue); if (ddl_fucha.SelectedValue == "1") { exeCheckArgs.RectificationResult = Convert.ToChar(ddl_zhqk.SelectedValue); } else { exeCheckArgs.RectificationResult = ' '; } ExtAspNet.CheckBoxList checkboxlist = row_TouchFiled.FindControl("touchFiled1") as ExtAspNet.CheckBoxList; if (checkboxlist.SelectedIndexArray.Length == 0) { exeCheckArgs.TouchFiled = ""; } else { for (int i = 0; i < checkboxlist.SelectedValueArray.Length; i++) { exeCheckArgs.TouchFiled = exeCheckArgs.TouchFiled + "|" + checkboxlist.SelectedValueArray[i]; } } exeCheckArgs.Remark = txt_remark.Text; ExtAspNet.DropDownList dropdownList = row_CheckResult.FindControl("DdcheckResult1") as ExtAspNet.DropDownList; exeCheckArgs.CheckResult = Convert.ToInt64(dropdownList.SelectedValue); exeCheckArgs.CheckOne = Convert.ToInt64((Session["User"] as DataTable).Rows[0]["USER_ID"]); exeCheckArgs.CheckOneName = (Session["User"] as DataTable).Rows[0]["USER_NAME"].ToString(); exeCheckArgs.CheckTwo = Convert.ToInt64(ddl_Checker.SelectedValue); exeCheckArgs.CheckTwoName = ddl_Checker.SelectedText.ToString(); if (Session["ExeCheckTitleClassList"] != null) { List <AnswerTitle> ListAnswerTitle = Session["ExeCheckTitleClassList"] as List <AnswerTitle>; if (ListAnswerTitle != null) { string CheckResult = "{0}卫生监督员【{1},{2}】,对【{3}】进行现场检查。检查人员向【{4}】负责人出示执法证并了解相关情况,经检查发现:" + Environment.NewLine; CheckResult = string.Format(CheckResult, (Session["User"] as DataTable).Rows[0]["ORGAN_NAME"].ToString(), (Session["User"] as DataTable).Rows[0]["USER_NAME"].ToString(), ddl_Checker.SelectedText, Session["UnitName"].ToString(), Session["UnitName"].ToString()); string CheckAdvice = ""; int a = 1; int b = 1; //List<AnswerTitle> ListAnswerTitle1 = Session["ExeCheckTitleClassList"] as List<AnswerTitle>; for (int i = 0; i < ListAnswerTitle.Count; i++) { if (ListAnswerTitle[i].IsAnswered == true) { if (ListAnswerTitle[i].TitleRusult != "") { CheckResult = CheckResult + a.ToString() + "、 " + ListAnswerTitle[i].TitleRusult + "。" + Environment.NewLine; a++; } if (ListAnswerTitle[i].TitleAdvice != "") { CheckAdvice = CheckAdvice + b.ToString() + "、 " + ListAnswerTitle[i].TitleAdvice + "。" + Environment.NewLine; b++; } } } exeCheckArgs.CheckNotes = string.Format(CheckResult, exeCheckArgs.CheckOneName, exeCheckArgs.CheckTwoName, exeCheckArgs.UnitName, exeCheckArgs.UnitName); exeCheckArgs.CheckOpinion = CheckAdvice; } else { exeCheckArgs.CheckNotes = ""; exeCheckArgs.CheckOpinion = ""; } } else { exeCheckArgs.CheckNotes = ""; exeCheckArgs.CheckOpinion = ""; } exeCheckArgs.listCheckTitle = Session["ExeCheckTitleClassList"] as List <AnswerTitle>; exeCheckArgs.organ_id = Convert.ToInt64((Session["User"] as DataTable).Rows[0]["ORGAN_ID"]); exeCheckArgs.UserId = Convert.ToInt64((Session["User"] as DataTable).Rows[0]["USER_ID"]); OnExeCheck(null, exeCheckArgs); }