コード例 #1
0
    private void loadDM()
    {
        drlKhuvuc.DataSource     = dm.BUS_loadDM().Tables[0];
        drlKhuvuc.DataTextField  = "tenKV";
        drlKhuvuc.DataValueField = "maKV";
        drlKhuvuc.DataBind();

        drlLoaiBDS.DataSource     = dm.BUS_loadDM().Tables[1];
        drlLoaiBDS.DataTextField  = "tenLoaiBDS";
        drlLoaiBDS.DataValueField = "maLoaiBDS";
        drlLoaiBDS.DataBind();
    }
コード例 #2
0
    private void loadDM()
    {
        drlmakv.DataSource     = dm.BUS_loadDM().Tables[0];
        drlmakv.DataTextField  = "tenKV";
        drlmakv.DataValueField = "maKV";
        drlmakv.DataBind();
        drlmakv.Items.Insert(0, new ListItem("--Chọn khu vực--", "-1"));


        drlloaibds.DataSource     = dm.BUS_loadDM().Tables[1];
        drlloaibds.DataTextField  = "tenLoaiBDS";
        drlloaibds.DataValueField = "maLoaiBDS";
        drlloaibds.DataBind();
        drlloaibds.Items.Insert(0, new ListItem("--Chọn loại BĐS--", "-1"));
    }
コード例 #3
0
    private void loadDM()
    {
        DropDownList khuvuc = (DropDownList)Viewedit.FindControl("drlKhuvuc");

        dm = new bus_Danhmuc();
        khuvuc.DataSource = dm.BUS_loadDM().Tables[0];
        //khuvuc.DataSource = Enum.GetNames(typeof(TestimonialStatus.CurrentTestimonialStatus));
        khuvuc.DataTextField  = "tenKV";
        khuvuc.DataValueField = "maKV";
        khuvuc.DataBind();

        DropDownList loaibds = (DropDownList)Viewedit.FindControl("drlLoaiBDS");

        loaibds.DataSource     = dm.BUS_loadDM().Tables[1];
        loaibds.DataTextField  = "tenLoaiBDS";
        loaibds.DataValueField = "maLoaiBDS";
        loaibds.DataBind();
    }
コード例 #4
0
    void laydsBDS()
    {
        try
        {
            DataTable dt = new DataTable();
            dt = admin.BUS_view_batdongsan("", -1, -1, Convert.ToInt16(Request.QueryString["ID"]), -1).Tables[0];
            Viewedit.DataSource = dt;
            Viewedit.DataBind();

            DropDownList khuvuc = (DropDownList)Viewedit.FindControl("drlKhuvuc");
            khuvuc.DataSource     = dm.BUS_loadDM().Tables[0];
            khuvuc.DataTextField  = "tenKV";
            khuvuc.DataValueField = "maKV";
            khuvuc.DataBind();

            ListItem selectedKV = khuvuc.Items.FindByValue(dt.Rows[0]["maKV"].ToString());

            if (selectedKV != null)
            {
                selectedKV.Selected = true;
            }

            DropDownList loaibds = (DropDownList)Viewedit.FindControl("drlLoaiBDS");
            loaibds.DataSource     = dm.BUS_loadDM().Tables[1];
            loaibds.DataTextField  = "tenLoaiBDS";
            loaibds.DataValueField = "maLoaiBDS";
            loaibds.DataBind();

            ListItem selectedLoaibds = loaibds.Items.FindByValue(dt.Rows[0]["maLoaiBDS"].ToString());

            if (selectedLoaibds != null)
            {
                selectedLoaibds.Selected = true;
            }


            CheckBox chknoibat = (CheckBox)Viewedit.FindControl("chkNoiBat");
            chknoibat.Checked = Convert.ToBoolean(dt.Rows[0]["NoiBat"].ToString());

            CheckBox chkdaban = (CheckBox)Viewedit.FindControl("chkDaBan");
            chkdaban.Checked = Convert.ToBoolean(dt.Rows[0]["DaBan"].ToString());

            //DataTable dt1 = new DataTable();
            //dt1.Columns.Add("hinhanh", typeof(string));
            //DataRow rows;
            //if (dt != null && dt.Rows.Count > 0) foreach (DataRow row in dt.Rows)
            //    {
            //        if (row["hinhanh"].ToString() != null && row["hinhanh"].ToString() != "")
            //        {
            //            //string linkfile = link.Uploadfile_congviec(Session["Auto_idcongviec"].ToString());
            //            FileInfo file = new FileInfo( row["hinhanh"].ToString());
            //            string Mb = (file.Length / 1024).ToString();
            //            string stenfile = string.Format("{0} ({1}KB)", row["hinhanh"].ToString(), Mb);
            //            rows = dt1.NewRow();
            //            rows["hinhanh"] = stenfile;
            //            dt1.Rows.Add(rows);
            //        }
            //    }
            //string file = dt.Rows[0]["hinhanh"].ToString();
            //FileUpload txtanhdaidien = (FileUpload)Viewedit.FindControl("txtanhdaidien");
            //txtanhdaidien.FileName = file;
            GridView gvanhdaidien = (GridView)Viewedit.FindControl("gv_anhdaidien");
            gvanhdaidien.DataSource = dt;
            gvanhdaidien.DataBind();

            GridView gv = (GridView)Viewedit.FindControl("gv_tenfile");
            dtanh = admin.BUS_view_batdongsan("", -1, -1, Convert.ToInt16(Request.QueryString["ID"]), -1).Tables[1];
            Session.Remove("anhct");
            Session["anhct"] = dtanh;
            gv.DataSource    = dtanh;
            gv.DataBind();
        }
        catch { }
    }