Extending Sage 200 Lists and Grids

February 4, 2016

Below are a couple of really useful extensions that can be improved upon to include many different types of column and amendable control, though you will have to manipulate the returned column when dealing with more complex lookup controls.

public static Sage.ObjectStore.Controls.GridColumn AddNumericColumn(this Sage.ObjectStore.Controls.Grid Grid, string Caption, string DisplayMember)
{
   return AddNumericColumn(Grid, Caption, DisplayMember, false, false);
}
public static Sage.ObjectStore.Controls.GridColumn AddNumericColumn(this Sage.ObjectStore.Controls.Grid Grid, string Caption, string DisplayMember, bool AutoSize, bool Amendable)
{
   var column = new Sage.ObjectStore.Controls.GridColumn();
   column.Caption = Caption;
   column.DisplayMember = DisplayMember;
   column.AutoSize = AutoSize;
   column.Alignment = Sage.Common.Controls.CaptionAlignment.Right;
   column.ContentAlignment = System.Drawing.ContentAlignment.MiddleRight;
   Grid.Columns.Add(column);

  if (Amendable)
  {
      var n = new Sage.ObjectStore.Controls.NumberTextBox();
      Grid.Controls.Add(n);
      column.Control = n;
      column.ControlMember = "Text";
   }
   return column;
}

Including and utilising the above extensions will save a considerable amount of keying / coding time, especially when dealing with large lists and grids.

As with any article posted here, if you would like any more information just get in touch.

Back to News
CONTACT US TODAY AND LET'S TALK BUSINESS