コード例 #1
0
        //联动
        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList2.Items.Clear();
            RegionDC dc       = new RegionDC();
            string   sub_name = DropDownList1.SelectedValue;
            DataSet  ds       = null;

            if (sub_name.Equals("ALL"))
            {
                ds = dc.getEnableRegion();
            }
            else
            {
                ds = dc.getRegion_nameBySub_name(DropDownList1.SelectedValue);
            }
            if (ds != null)
            {
                DropDownList2.DataSource     = ds.Tables[0].DefaultView;
                DropDownList2.DataValueField = "region_name";
                DropDownList2.DataBind();
                DropDownList2.Items.Insert(0, "ALL");
            }
            else
            {
                PageUtil.showToast(this, "数据异常!");
            }
        }
コード例 #2
0
        //获取GridView内容
        //private DataTable GetGridViewData(DataTable table)
        //{
        //    table.Columns.Add(new DataColumn("Po_no"));
        //    table.Columns.Add(new DataColumn("Line_num"));
        //    table.Columns.Add(new DataColumn("Item_name"));
        //    table.Columns.Add(new DataColumn("RECEIPT_NO"));
        //    table.Columns.Add(new DataColumn("Rcv_qty"));
        //    table.Columns.Add(new DataColumn("RETURN_qty"));
        //    table.Columns.Add(new DataColumn("VENDOR_CODE"));
        //    foreach (GridViewRow row in GridView1.Rows)
        //    {
        //        DataRow sourseRow = table.NewRow();
        //        sourseRow["Po_no"] = row.Cells[0].Text;
        //        sourseRow["Item_name"] = row.Cells[1].Text;
        //        sourseRow["RECEIPT_NO"] = row.Cells[2].Text;
        //        sourseRow["Line_num"] = row.Cells[3].Text;
        //        sourseRow["Rcv_qty"] = row.Cells[4].Text;
        //        sourseRow["RETURN_qty"] = row.Cells[5].Text;
        //        sourseRow["VENDOR_CODE"] = row.Cells[6].Text;
        //        table.Rows.Add(sourseRow);
        //    }
        //    return table;
        //}
        //联动

        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList2.Items.Clear();
            RegionDC regionDC = new RegionDC();
            string   text     = DropDownList1.SelectedValue.ToString();
            DataSet  ds2      = regionDC.getRegion_nameBySub_name(text);

            if (ds2 != null)
            {
                DropDownList2.DataSource     = ds2.Tables[0].DefaultView;
                DropDownList2.DataValueField = "region_key";
                DropDownList2.DataTextField  = "region_name";
                DropDownList2.DataBind();
            }
            //else
            //    PageUtil.showAlert(this, "区域载入出错!");
            DropDownList2.Items.Insert(0, "--选择区域--");
        }