zoukankan      html  css  js  c++  java
  • 省市区下拉框三级联动

    protected void Page_Load(object sender, EventArgs e) //加载
    {
    if (!IsPostBack)
    {
    FileSheng();
    FileShi();
    FileQu();
    }
    }

    public void FileSheng() //省
    {
    DropSheng.DataSource=_context.ChinaStates.Where(p => p.ParentAreaCode == "0001");
    DropSheng.DataTextField = "AreaName";
    DropSheng.DataValueField = "AreaCode";

    DropSheng.DataBind();
    }

    public void FileShi() //市
    {
    string sheng = DropSheng.SelectedValue.ToString();
    DropShi.DataSource = _context.ChinaStates.Where(p => p.ParentAreaCode == sheng);
    DropShi.DataTextField = "AreaName";
    DropShi.DataValueField = "AreaCode";

    DropShi.DataBind();
    }

    public void FileQu() //区
    {
    string shi = DropShi.SelectedValue.ToString();
    DropQu.DataSource = _context.ChinaStates.Where(p => p.ParentAreaCode == shi);
    DropQu.DataTextField = "AreaName";
    DropQu.DataValueField = "AreaCode";

    DropQu.DataBind();
    }


    AutoPostBack=True; //属性修改
    protected void DropSheng_SelectedIndexChanged(object sender, EventArgs e)
    {
    FileShi();
    }

    AutoPostBack=True; //属性修改
    protected void DropShi_SelectedIndexChanged(object sender, EventArgs e)
    {
    FileQu();
    }

  • 相关阅读:
    Shortest Paths
    Minimum Spanning Trees
    Programming Assignment 1: WordNet
    Directed Graphs
    内连接
    数据中台文档--参考
    ORACLE触发器字段触发
    DTS
    oracle删除归档日志
    OGG 分区表
  • 原文地址:https://www.cnblogs.com/duan594939295/p/5065095.html
Copyright © 2011-2022 走看看