Example #1
0
        protected void BindGrid()
        {
            DataTable dt = ClassJopPosition.LoadData();

            this.ss_dt          = dt;
            datagrid.DataSource = dt;
            datagrid.DataBind();
        }
Example #2
0
        private void LoadPosition()
        {
            DataTable dt = ClassJopPosition.LoadData();

            // Set Defult
            if (dt.Rows.Count == 0)
            {
                DataRow dr = dt.NewRow();
                dr["position"] = "";
                dr["cost"]     = "";
                dt.Rows.Add(dr);
            }

            dt.Columns.Add("name");
            foreach (DataRow dr in dt.Rows)
            {
                dr["name"] = dr["position"] + " " + dr["cost"] + " บาท";
            }

            ddlPosition.DataTextField  = "name";
            ddlPosition.DataValueField = "id";
            ddlPosition.DataSource     = dt;
            ddlPosition.DataBind();
        }