protected void EntityCode_Init(object sender, EventArgs e) { DataTable dtRecord = GlobalClass.EntityTable(); ASPxComboBox combo = sender as ASPxComboBox; combo.DataSource = dtRecord; ListBoxColumn l_ValueField = new ListBoxColumn(); l_ValueField.FieldName = "ID"; l_ValueField.Caption = "CODE"; l_ValueField.Width = 30; combo.Columns.Add(l_ValueField); ListBoxColumn l_TextField = new ListBoxColumn(); l_TextField.FieldName = "NAME"; combo.Columns.Add(l_TextField); combo.ValueField = "ID"; combo.TextField = "NAME"; combo.DataBind(); combo.ItemStyle.Wrap = DevExpress.Utils.DefaultBoolean.True; GridViewEditFormTemplateContainer container = combo.NamingContainer.NamingContainer as GridViewEditFormTemplateContainer; //MRPClass.PrintString("exp:" + !container.Grid.IsNewRowEditing); if (!container.Grid.IsNewRowEditing) { combo.Value = DataBinder.Eval(container.DataItem, "EntityCode").ToString(); } }
protected void Entity_Init(object sender, EventArgs e) { ASPxComboBox combo = sender as ASPxComboBox; combo.DataSource = POClass.PO_EntityCode_Table(); ListBoxColumn lv = new ListBoxColumn(); lv.FieldName = "ID"; lv.Caption = "Code"; lv.Width = 50; combo.Columns.Add(lv); ListBoxColumn lt = new ListBoxColumn(); lt.FieldName = "NAME"; lt.Caption = "Entity"; lt.Width = 250; combo.Columns.Add(lt); combo.ItemStyle.Wrap = DevExpress.Utils.DefaultBoolean.True; combo.ValueField = "ID"; combo.TextField = "NAME"; combo.DataBind(); GridViewEditFormTemplateContainer container = ((ASPxComboBox)sender).NamingContainer.NamingContainer as GridViewEditFormTemplateContainer; if (!container.Grid.IsNewRowEditing) { combo.Value = DataBinder.Eval(container.DataItem, "EntityCode").ToString(); combo.Text = DataBinder.Eval(container.DataItem, "EntityCode").ToString(); } }
protected void UserStatus_Init(object sender, EventArgs e) { DataTable dtRecord = AccountClass.UserStatusTable(); ASPxComboBox combo = sender as ASPxComboBox; combo.DataSource = dtRecord; ListBoxColumn l_ValueField = new ListBoxColumn(); l_ValueField.FieldName = "ID"; l_ValueField.Caption = "CODE"; l_ValueField.Width = 0; combo.Columns.Add(l_ValueField); ListBoxColumn l_TextField = new ListBoxColumn(); l_TextField.FieldName = "NAME"; l_TextField.Caption = "STATUS"; combo.Columns.Add(l_TextField); combo.ValueField = "ID"; combo.TextField = "NAME"; combo.DataBind(); GridViewEditFormTemplateContainer container = combo.NamingContainer.NamingContainer as GridViewEditFormTemplateContainer; if (!container.Grid.IsNewRowEditing) { combo.Value = DataBinder.Eval(container.DataItem, "StatusKey").ToString(); } }
protected void hplkUpdate_Init(object sender, EventArgs e) { HyperLink hyperLink = sender as HyperLink; GridViewEditFormTemplateContainer container = hyperLink.NamingContainer as GridViewEditFormTemplateContainer; hyperLink.NavigateUrl = String.Format("javascript:hplkUpdate_Click({0})", container.Grid.ClientInstanceName); }
protected void BUHead_Init(object sender, EventArgs e) { DataTable dtRecord = AccountClass.UserList(); ASPxComboBox combo = sender as ASPxComboBox; combo.DataSource = dtRecord; ListBoxColumn l_ValueField = new ListBoxColumn(); l_ValueField.FieldName = "PK"; l_ValueField.Caption = "CODE"; l_ValueField.Width = 0; combo.Columns.Add(l_ValueField); ListBoxColumn l_TextField = new ListBoxColumn(); l_TextField.FieldName = "CompleteName"; l_TextField.Caption = "Employee Name"; combo.Columns.Add(l_TextField); combo.ValueField = "PK"; combo.TextField = "CompleteName"; combo.DataBind(); GridViewEditFormTemplateContainer container = combo.NamingContainer.NamingContainer as GridViewEditFormTemplateContainer; //MRPClass.PrintString("exp:" + !container.Grid.IsNewRowEditing); if (!container.Grid.IsNewRowEditing) { combo.Value = DataBinder.Eval(container.DataItem, "BUHead").ToString(); } }
protected void txtCategoryName_Init(object sender, EventArgs e) { ASPxTextBox txt = (ASPxTextBox)sender; ASPxPageControl container = (ASPxPageControl)txt.NamingContainer; GridViewEditFormTemplateContainer templateContainer = (GridViewEditFormTemplateContainer)container.NamingContainer; txt.ValidationSettings.ValidationGroup = templateContainer.ValidationGroup; txt.Value = templateContainer.KeyValue; //etc. }
protected void hfEditorData_Init(object sender, EventArgs e) { ASPxHiddenField hiddenField = sender as ASPxHiddenField; GridViewEditFormTemplateContainer container = hiddenField.NamingContainer as GridViewEditFormTemplateContainer; foreach (GridViewColumn col in container.Grid.Columns) { GridViewDataColumn dataCol = col as GridViewDataColumn; if ((dataCol != null) && (!hiddenField.Contains(dataCol.FieldName))) { hiddenField[dataCol.FieldName] = DataBinder.Eval(container.DataItem, dataCol.FieldName); } } }
protected void cboTipoSangre_Init(object sender, EventArgs e) { ASPxComboBox cmbParent = (ASPxComboBox)sender; //GridViewDataRowTemplateContainer templateContainer = (GridViewDataRowTemplateContainer)cmbParent.NamingContainer; GridViewEditFormTemplateContainer templateContainer = (GridViewEditFormTemplateContainer)cmbParent.NamingContainer; //cmbParent.ClientSideEvents.SelectedIndexChanged = string.Format("function(s, e) {{ OnSelectedIndexChanged(s, e, {0}); }}", templateContainer.VisibleIndex); DataTable dtbCombo = new ClsGeneral().ObtenerTipoSangre(); cmbParent.DataSource = dtbCombo; cmbParent.ValueField = Constantes.ColumnaTipoSangreCodigo; cmbParent.ValueType = typeof(Int32); cmbParent.TextField = Constantes.ColumnaTipoSangreNombre; cmbParent.DataBindItems(); ObtenerDatosEmpleado(); SelecetedCbo(_strTipoSangre, cmbParent); }
protected void btnCreateSubject_OnInit(object sender, EventArgs e) { try { //var x = ((ASPxButton)sender).NamingContainer; GridViewEditFormTemplateContainer c = ((ASPxButton)sender).NamingContainer as GridViewEditFormTemplateContainer; ASPxGridView grid = c.Grid; if (grid.IsNewRowEditing) { ((ASPxButton)sender).Visible = false; } else { //string ID = c.Grid.GetRowValues(c.VisibleIndex, "ID").ToString(); string personID = c.Grid.GetRowValues(c.VisibleIndex, "personID").ToString(); string fname = c.Grid.GetRowValues(c.VisibleIndex, "FirstName").ToString(); string lname = c.Grid.GetRowValues(c.VisibleIndex, "LastName").ToString(); string name = String.Format("{0} {1}", fname, lname); //string subjID = "0"; ((ASPxButton)sender).Text = String.Format("Create new subject for {0}", name); string authority = HttpContext.Current.Request.Url.Authority; string newpage = String.Format("../Track/CreateSubject.aspx?personID={0}", personID); //string newpage = String.Format("{0}/Track/Subject.aspx?ID={1}", authority, ID); string fx = String.Format("function(s,e){{ location.assign( '{0}');}}", newpage); string fx2 = String.Format("function(s,e) {{ window.open('{1}') }}", name, newpage); Debug.WriteLine(fx2); ((ASPxButton)sender).ClientSideEvents.Click = fx2; // String.Format("function(s,e){{alert('{0}');}}",newpage); ((ASPxButton)sender).AutoPostBack = true; } } catch (Exception) { } }
public void InstantiateIn(Control _container) { GridViewEditFormTemplateContainer container = _container as GridViewEditFormTemplateContainer; object[] values = (object[])container.Grid.GetRowValues(container.VisibleIndex, new string[] { "Id", "Type", "DataValue" }); string id = Convert.ToString(values[0]); string dataType = Convert.ToString(values[1]); string dataValue = Convert.ToString(values[2]); ASPxTextBox tb = new ASPxTextBox(); tb.ID = "id"; container.Controls.Add(tb); tb.Text = values[0].ToString(); tb.ReadOnly = true; tb = new ASPxTextBox(); tb.ID = "datatype"; container.Controls.Add(tb); tb.Text = values[1].ToString(); tb.ReadOnly = true; switch (dataType) { case "Text": ASPxTextBox txt = new ASPxTextBox(); txt.ID = "txt"; container.Controls.Add(txt); txt.Text = dataValue; break; case "DateTime": ASPxDateEdit date = new ASPxDateEdit(); date.ID = "date"; container.Controls.Add(date); date.Date = Convert.ToDateTime(dataValue); break; case "Dictionary1": ASPxComboBox cmb = new ASPxComboBox(); cmb.ID = "dict"; container.Controls.Add(cmb); cmb.DataSource = DataProvider.GetDictionaryData(DataType.Dictionary1); cmb.TextField = "Data"; cmb.ValueField = "Id"; cmb.DataBind(); cmb.Value = dataValue; break; case "Dictionary2": ASPxComboBox cmb2 = new ASPxComboBox(); cmb2.ID = "dict"; container.Controls.Add(cmb2); cmb2.DataSource = DataProvider.GetDictionaryData(DataType.Dictionary2); cmb2.TextField = "Data"; cmb2.ValueField = "Id"; cmb2.DataBind(); cmb2.Value = dataValue; break; } ASPxGridViewTemplateReplacement updateBtn = new ASPxGridViewTemplateReplacement(); updateBtn.ReplacementType = GridViewTemplateReplacementType.EditFormUpdateButton; container.Controls.Add(updateBtn); ASPxGridViewTemplateReplacement cancelBtn = new ASPxGridViewTemplateReplacement(); cancelBtn.ReplacementType = GridViewTemplateReplacementType.EditFormCancelButton; container.Controls.Add(cancelBtn); }