protected void gridLookup_Init(object sender, EventArgs e) { ASPxGridLookup gl = (ASPxGridLookup)sender; gl.DataSource = CreateDataSource(); gl.DataBind(); }
protected void gridLookup_Init(object sender, EventArgs e) { ASPxGridLookup gl = (ASPxGridLookup)sender; gl.GridView.Width = Unit.Pixel(165); gl.DataSource = CreateDataIEnumerableSourceFromEnum(typeof(CustomEnum)); gl.DataBind(); }
public void LoadManufacurer(ASPxGridLookup searchlookupedit) { try { ds = this.GetPatient(); searchlookupedit.KeyFieldName = "PatientId"; searchlookupedit.DataSource = ds.Tables["PatientsDetails"]; searchlookupedit.DataBind(); } catch (Exception ex) { Security secs = new Security(); secs.ErrorDesscription = ex.Message; secs.ErrorModule = "Select all permit types"; secs.SaveError(); } }
public void LoadDepartments(ASPxGridLookup searchlookupedit) { try { ds = this.GetDepartment(); searchlookupedit.KeyFieldName = "DeptCode"; searchlookupedit.DataSource = ds.Tables["Departments"]; searchlookupedit.DataBind(); } catch (Exception ex) { Security secs = new Security(); secs.ErrorDesscription = ex.Message; secs.ErrorModule = "Select all permit types"; secs.SaveError(); } }
public void FilldataSource_DataBind_Dev(Control Ctrl, string Sqlstr, object LinQ, Boolean ActivePropertyGrid) { if (_Conexion.State == ConnectionState.Closed) { _Conexion.Open(); } if (Sqlstr != "") { SqlDataAdapter MysqlAdapter = new SqlDataAdapter(Sqlstr, _Conexion); DataSet Mydataset = new DataSet(); MysqlAdapter.Fill(Mydataset); if (Ctrl is ASPxGridView) { ASPxGridView Ctrl1 = (ASPxGridView)Ctrl; Ctrl1.DataSource = Mydataset.Tables[0]; } if (Ctrl is ASPxGridLookup) { ASPxGridLookup Ctrl1 = (ASPxGridLookup)Ctrl; Ctrl1.DataSource = Mydataset.Tables[0]; } if (Ctrl is ASPxComboBox) { ASPxComboBox Ctrl1 = (ASPxComboBox)Ctrl; Ctrl1.DataSource = Mydataset.Tables[0]; } if (Ctrl is BootstrapComboBox) { BootstrapComboBox Ctrl1 = (BootstrapComboBox)Ctrl; Ctrl1.DataSource = Mydataset.Tables[0]; } } else { if (Ctrl is ASPxGridView) { ASPxGridView Ctrl1 = (ASPxGridView)Ctrl; Ctrl1.DataSource = LinQ; } if (Ctrl is ASPxGridLookup) { ASPxGridLookup Ctrl1 = (ASPxGridLookup)Ctrl; Ctrl1.DataSource = LinQ; } if (Ctrl is ASPxComboBox) { ASPxComboBox Ctrl1 = (ASPxComboBox)Ctrl; Ctrl1.DataSource = LinQ; } if (Ctrl is BootstrapComboBox) { BootstrapComboBox Ctrl1 = (BootstrapComboBox)Ctrl; Ctrl1.DataSource = LinQ; } } if (ActivePropertyGrid == false) { if (Ctrl is ASPxGridView) { ASPxGridView Ctrl1 = (ASPxGridView)Ctrl; Ctrl1.DataBind(); } if (Ctrl is ASPxGridLookup) { ASPxGridLookup Ctrl1 = (ASPxGridLookup)Ctrl; Ctrl1.DataBind(); } if (Ctrl is ASPxComboBox) { ASPxComboBox Ctrl1 = (ASPxComboBox)Ctrl; Ctrl1.DataBind(); } if (Ctrl is BootstrapComboBox) { BootstrapComboBox Ctrl1 = (BootstrapComboBox)Ctrl; Ctrl1.DataBind(); } } _Conexion.Close(); }
public List<HtmlTableCell> BuildGridLookup(string fieldtext, string id, string tablename, string alias, string helptext, string SkinID, int length, string datasource, bool isReadOnly, string controlValue) { List<HtmlTableCell> c = new List<HtmlTableCell>(); try { HtmlTableCell cell = new HtmlTableCell(); cell.Attributes.Add("class", "tblFormViewtdLabel"); cell.Style.Add("Width", "20%"); ASPxLabel lb = new ASPxLabel() { Text = fieldtext }; cell.Controls.Add(lb); HtmlTableCell celledit = new HtmlTableCell(); celledit.Attributes.Add("class", "tblFormViewtdValue"); celledit.Style.Add("Width", "30%"); //json attribute DataTable dtvalues = JsonConvert.DeserializeObject<DataTable>(datasource); string textformat = dtvalues.Rows[0]["textformat"].ToString(); string tablequery = dtvalues.Rows[0]["tablequery"].ToString(); string type = dtvalues.Rows[0]["type"].ToString(); string colSetting = dtvalues.Rows[0]["colSetting"].ToString(); string datavalue = dtvalues.Rows[0]["datavalue"].ToString(); string wherecondition = dtvalues.Rows[0]["wherecondition"].ToString(); SqlDataSource sqldata = new SqlDataSource() { ConnectionString = DataServices.ConnectString }; ASPxGridLookup gl = new ASPxGridLookup(); switch (type) { #region table case "table": { string select = string.Format("SELECT * FROM {0}", tablequery); string querysql = ProccessquerySql(select, wherecondition); proccessCreateColumnGridLookup(type,"",colSetting, gl); sqldata.SelectCommandType = SqlDataSourceCommandType.Text; sqldata.SelectCommand = querysql; gl.DataSource = sqldata; gl.KeyFieldName = datavalue; } break; #endregion #region query case "query": { string select = tablequery; string querysql = ProccessquerySql(select, wherecondition); proccessCreateColumnGridLookup(type,"", colSetting, gl); sqldata.SelectCommandType = SqlDataSourceCommandType.Text; sqldata.SelectCommand = querysql; gl.DataSource = sqldata; gl.KeyFieldName = select.IndexOf('*') >= 0 ? datavalue : datavalue.ToLower(); } break; #endregion #region query case "sp": { proccessCreateColumnGridLookup(type, "", colSetting, gl); sqldata.SelectCommandType = SqlDataSourceCommandType.StoredProcedure; sqldata.SelectCommand = tablequery; ProccessAddparamForStore(wherecondition, sqldata); gl.DataSource = sqldata; gl.KeyFieldName = datavalue; } break; #endregion } gl.ID = id; gl.GridViewProperties.Settings.ShowFilterRow = true; gl.SkinID = SkinID; gl.GridView.Width = Unit.Pixel((gl.GridView.Columns.Count > 0 ? gl.GridView.Columns.Count : 1) * (gl.GridView.Columns.Count > 0 ? int.Parse(gl.GridView.Columns[0].Width.Value.ToString()) : 1)); gl.Width = Unit.Percentage(99); gl.Theme = "DevEx"; gl.AutoPostBack = false; gl.TextFormatString = textformat; gl.DataBind(); gl.Value = controlValue; gl.ReadOnly = isReadOnly; celledit.Controls.Add(gl); c.Add(cell); c.Add(celledit); cot += 2; } catch (Exception ex) { LogAction(0, ex.ToString()); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), Guid.NewGuid().ToString(), "<script> alert('BuildGridLookup fieldname" + id + "'); </script>", false); } return c; }