We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Column Alignment in a dbGrid Combo Field

When the value is a numeric one and I am mapping it to a string for display in a combo box the display is always right justified. I even tried setting the HorizontalAlignment to GridHorizontalAlignment.Left. on the columnstyle and it still show up wrong. myGrid.Model.ColStyles["column1"]..HorizontalAlignment = GridHorizontalAlignment.Left;

1 Reply

AD Administrator Syncfusion Team April 14, 2003 02:56 PM UTC

If your grid is a GridDataBoundGrid, then use either the GridBoundColumns (if you explicitly added them) or Binder.InternalColumns to set this value.
//set up the comboboxes
GridStyleInfo style = this.gridDataBoundGrid1.Binder.InternalColumns["masterComboCol"].StyleInfo;
style.DataSource = GetTheMasterTable();
style.DisplayMember = "masterdesc";
style.ValueMember = "id";
style.BackColor = Color.LightBlue;
style.CellType = "ComboBox";
style.HorizontalAlignment = GridHorizontalAlignment.Left;

Live Chat Icon For mobile
Up arrow icon