• .NET ------ 省市县反向赋值


    将选中的赋值到下拉框中,因为是三级联动的所以要注意调用触发下一级的方法

     首先将一个整的进行截取,分别赋值到对应的地方

            {
                string sGongSiGangWeiGuid = this.HidGongSiGangWeiGuid.Value;
                ITEM.Model.qdMis4.UGongSiGangWei mGw = _bllGongSiGangWei.GetModelSelUGongSiGangWei3("GongSi_Name,GongSi_4001_Name,GongSi_4001_Code,GongSi_Address,GongSi_Tel,GongSi_User,GangWei_Name,GangWei_Content,GangWei_UserSum", base.EnterpriseGuid,sGongSiGangWeiGuid);
                this.tbGongSi_Name.Text = mGw.GongSi_Name;
                this.tbGongSi_Tel.Text = mGw.GongSi_Tel;
                this.tbGongSi_User.Text = mGw.GongSi_User;     
                this.tbGongSi_Address.Text = mGw.GongSi_Address;
                this.tbGangWei_Name.Text = mGw.GangWei_Name;
                this.tbGangWei_Content.Text = mGw.GangWei_Content;
    
                this.ddlAreaSheng_GongSi_4001_Code.SelectedValue = mGw.GongSi_4001_Code.Substring(0, 18);
                ddlArea_GongSi_4001_Code_SelectedIndexChanged(ddlAreaSheng_GongSi_4001_Code, e);
                this.ddlAreaShi_GongSi_4001_Code.SelectedValue= mGw.GongSi_4001_Code.Substring(0, 27);
                ddlArea_GongSi_4001_Code_SelectedIndexChanged(ddlAreaShi_GongSi_4001_Code, e);
                this.ddlAreaXian_GongSi_4001_Code.SelectedValue= mGw.GongSi_4001_Code.Substring(0, 36);
    
    
            }

    联动的方法

        protected void ddlArea_GongSi_4001_Code_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList ddl = (DropDownList)sender;
            if (ddl.ID == "ddlAreaSheng_GongSi_4001_Code")
            {
                ddlAreaShi_GongSi_4001_Code.Items.Clear();
                ddlAreaXian_GongSi_4001_Code.Items.Clear();
                string scode = ddl.SelectedValue;
                List<ITEM.Model.qdCnt4.FourCollsType> mList = _bllTypeColls.Get_Ex_FourCollsTypeList_CodeDown("TypeCollCode,TypeCollName", base.EnterpriseGuid, 4001, scode, 3,(float)_iFlag);
                ddlAreaShi_GongSi_4001_Code.DataTextField = "TypeCollName";
                ddlAreaShi_GongSi_4001_Code.DataValueField = "TypeCollCode";
                ddlAreaShi_GongSi_4001_Code.DataSource = mList;
                ddlAreaShi_GongSi_4001_Code.DataBind();
                ddlAreaShi_GongSi_4001_Code.Items.Insert(0, new ListItem());
            }
            else if (ddl.ID == "ddlAreaShi_GongSi_4001_Code")
            {
                ddlAreaXian_GongSi_4001_Code.Items.Clear();
                string scode = ddl.SelectedValue;
                List<ITEM.Model.qdCnt4.FourCollsType> mList = _bllTypeColls.Get_Ex_FourCollsTypeList_CodeDown("TypeCollCode,TypeCollName", base.EnterpriseGuid, 4001, scode, 4,(float)_iFlag);
                ddlAreaXian_GongSi_4001_Code.DataTextField = "TypeCollName";
                ddlAreaXian_GongSi_4001_Code.DataValueField = "TypeCollCode";
                ddlAreaXian_GongSi_4001_Code.DataSource = mList;
                ddlAreaXian_GongSi_4001_Code.DataBind();
                ddlAreaXian_GongSi_4001_Code.Items.Insert(0, new ListItem());
            }
        }

    保存的时候省市县追加到一块

            if (this.ddlAreaXian_GongSi_4001_Code.SelectedValue == string.Empty)
            {
                uXueShengJiuYe.GongSi_4001_Code = string.Empty;
                uXueShengJiuYe.GongSi_4001_Name = string.Empty;
              
            }
            else
            {
                uXueShengJiuYe.GongSi_4001_Code = this.ddlAreaXian_GongSi_4001_Code.SelectedValue;
    
                uXueShengJiuYe.GongSi_4001_Name = this.ddlAreaSheng_GongSi_4001_Code.SelectedItem.Text.Replace("", "").Replace("", "") + "/" + this.ddlAreaShi_GongSi_4001_Code.SelectedItem.Text.Replace("", "").Replace("", "") + "/" + this.ddlAreaXian_GongSi_4001_Code.SelectedItem.Text.Replace("", "").Replace("", "");
            }
  • 相关阅读:
    lamp
    mysql多实例部署
    mysql进阶
    rsync
    mysql基础
    httpd
    ftp
    高级命令之awk
    NFS
    网络进阶管理
  • 原文地址:https://www.cnblogs.com/obge/p/13542791.html
Copyright © 2020-2023  润新知