//-------------------------- ------------------------------------------- private void BindGridPopUpPeg() { HR_PEGAWAI_DAL _dalHR_PEGAWAI_DAL = null; Hashtable _htParameters = null; try { _dalHR_PEGAWAI_DAL = new HR_PEGAWAI_DAL(); _htParameters = new Hashtable(); _htParameters["p_keywords"] = txtSearchPeg.Text; gvwListPeg.DataSource = _dalHR_PEGAWAI_DAL.GetRows(_htParameters); gvwListPeg.DataBind(); } catch (Exception ex) { Utility.ShowMessageBox(this, Utility.LOAD_DATA_FAIL_MESSAGE, ex, null, null); } }
//asfor Karyawan private void BindGridPopUpKaryawan() { HR_PEGAWAI_DAL _dalHR_PEGAWAI_DAL = null; Hashtable _htParameters = null; try { _dalHR_PEGAWAI_DAL = new HR_PEGAWAI_DAL(); _htParameters = new Hashtable(); _htParameters["p_keywords"] = txtSearchKaryawan.Text; _htParameters["p_status"] = "1"; if (Session[SessionKey.CURRENT_USER_HRMS_ROLE].ToString() == "1") { _htParameters["p_NIK"] = Session[SessionKey.CURRENT_USER_HRMS_EMP_CODE].ToString(); } gvwListKaryawan.DataSource = _dalHR_PEGAWAI_DAL.GetRows(_htParameters); gvwListKaryawan.DataBind(); } catch (Exception ex) { Utility.ShowMessageBox(this, Utility.LOAD_DATA_FAIL_MESSAGE, ex, null, null); } }
public void InstantiateIn(System.Web.UI.Control Container) { switch (ItemType) { case ListItemType.EditItem: if (InfoType == "Button") { ImageButton update_button = new ImageButton(); update_button.ID = "update_button"; update_button.CommandName = "Update"; update_button.ToolTip = "Update"; update_button.OnClientClick = "return confirm('Are you sure to update the record?')"; Container.Controls.Add(update_button); // Similarly, add a button for Cancel } else if (InfoType == "Textbox") // if other key and non key fields then bind textboxes with texts { TextBox field_txtbox = new TextBox(); field_txtbox.ID = FieldName; field_txtbox.Text = String.Empty; field_txtbox.ReadOnly = true; // if to update then bind the textboxes with coressponding field texts //otherwise for insert no need to bind it with text //if ((int)new Page().Session["InsertFlag"] == 0) field_txtbox.DataBinding += new EventHandler(OnDataBinding); Container.Controls.Add(field_txtbox); } else if (InfoType == "Label") { Label field_txtbox = new Label(); field_txtbox.ID = FieldName; field_txtbox.Text = String.Empty; field_txtbox.DataBinding += new EventHandler(OnDataBinding); Container.Controls.Add(field_txtbox); } else if (InfoType == "DropDownPeg") { HR_PEGAWAI_DAL _dalHR_PEGAWAI_DAL = new HR_PEGAWAI_DAL(); Hashtable _htParameters = new Hashtable(); DropDownList ddlPeg = new DropDownList(); ddlPeg.ID = FieldName; _htParameters["p_keywords"] = ""; ddlPeg.DataSource = _dalHR_PEGAWAI_DAL.GetRows(_htParameters); ddlPeg.DataValueField = "NIK"; ddlPeg.DataTextField = "NAMA"; ddlPeg.DataBind(); Container.Controls.Add(ddlPeg); } else { MST_SHIFT_DAL _dalMST_SHIFT = new MST_SHIFT_DAL(); Hashtable _htParameters = new Hashtable(); DropDownList ddlTgl = new DropDownList(); ddlTgl.ID = FieldName; _htParameters["p_keywords"] = ""; ddlTgl.DataSource = _dalMST_SHIFT.GetRowsKode(_htParameters); ddlTgl.DataValueField = "KODE"; ddlTgl.DataTextField = "KODE"; ddlTgl.DataBind(); ddlTgl.DataBinding += new EventHandler(OnDataBindingDDL); Container.Controls.Add(ddlTgl); } break; case ListItemType.Item: if (InfoType == "Label") { Label field_txtbox = new Label(); field_txtbox.ID = FieldName; field_txtbox.Text = String.Empty; field_txtbox.DataBinding += new EventHandler(OnDataBinding); Container.Controls.Add(field_txtbox); } break; } }