I have grid with column chooser at left. When I try to scroll to the right at the end of the grid I receive a memory error. Also scrollbar is in the middle position when the last column shows. How to fix this?
I use the following code for Initializing Layout:
{
try
SetFilterLabel();
}
catch (Exception)//don't show exception if we were not able to load
// disable key fields for editing
e.Layout.Bands["Weights"].Columns["TransKey"].CellActivation = Activation.Disabled;
this.gridViewWaste.DisplayLayout.Bands["Weights"].Columns["Weight"].Style =
this.gridViewWaste.DisplayLayout.Bands["Weights"].Columns["WasteCost"].Style =
this.gridViewWaste.DisplayLayout.Bands["Weights"].Columns["FoodTypeCost"].Style =
this.gridViewWaste.DisplayLayout.Bands["Weights"].Columns["ContainerWeight"].Style =
this.gridViewWaste.DisplayLayout.Bands["Weights"].Columns["ContainerCost"].Style =
this.gridViewWaste.DisplayLayout.Bands["Weights"].Columns["NItems"].Style =
this.gridViewWaste.DisplayLayout.Bands["Weights"].Columns["NProduced"].Style =
// Hide the irrelevant columns
//e.Layout.Bands["Transfers"].Columns["TransKey"].Hidden = true;
// Resize the columns that we are interested in
e.Layout.Bands["Weights"].Columns["IsPreconsumer"].ValueList = this.gridViewWaste.DisplayLayout.ValueLists["PreconsumerNames"];
e.Layout.Bands["Weights"].Columns["LossTypeID"].ValueList = this.gridViewWaste.DisplayLayout.ValueLists["LossNames"];
e.Layout.Bands["Weights"].Columns["StationTypeID"].ValueList = this.gridViewWaste.DisplayLayout.ValueLists["StationNames"];
e.Layout.Bands["Weights"].Columns["DaypartTypeID"].ValueList = this.gridViewWaste.DisplayLayout.ValueLists["DaypartNames"];
e.Layout.Bands["Weights"].Columns["UserTypeID"].ValueList = this.gridViewWaste.DisplayLayout.ValueLists["UserNames"];
this.gridViewWaste.DisplayLayout.Bands["Weights"].Columns["FoodTypeID"].Style =
// Make the style of these two columns Edit so that the value list dropdown arrow
// doesn't appear, since we are displaying a custom edit control rather than use the
// ValueList
//e.Layout.Bands["Transfers"].Columns["FoodTypeID"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Edit;
// We don't want to see the time portion of the date in the
// date columns, and we don't want to see the date portion
// in the time columns, so let's use the column's Format property
// to filter out the portions of the DateTime object that we don't want
// init colum headers
e.Layout.Bands["Weights"].Columns["WasteCost"].Header.Caption = "Waste Cost";
e.Layout.Bands["Weights"].Columns["FoodTypeCost"].Header.Caption = "Food Type Cost";
e.Layout.Bands["Weights"].Columns["ContainerTypeID"].Header.Caption = "Container Type";
e.Layout.Bands["Weights"].Columns["ContainerCost"].Header.Caption = "Container Cost";
e.Layout.Bands["Weights"].Columns["StationTypeID"].Header.Caption = "Station Type";
e.Layout.Bands["Weights"].Columns["DaypartTypeID"].Header.Caption = "DayPart Type";
e.Layout.Bands["Weights"].Columns["UserTypeID"].Header.Caption = "User Type";
e.Layout.Bands["Weights"].Columns["NItems"].Header.Caption = "Number of Items";
e.Layout.Bands["Weights"].Columns["UOMID"].Header.Caption = "Unit of Mesure";
// You can control the appearance of the separator using the SpecialRowSeparatorAppearance
// property.
e.Layout.Override.RowAppearance.BackColorAlpha = Infragistics.Win.Alpha.Transparent;
// use the same appearance for alternate rows
e.Layout.Override.RowAlternateAppearance = e.Layout.Override.RowAppearance;
e.Layout.Override.CellAppearance.AlphaLevel = 150;
e.Layout.Override.HeaderAppearance.AlphaLevel = 150;
// FILTER ROW FUNCTIONALITY RELATED ULTRAGRID SETTINGS
// ----------------------------------------------------------------------------------
// Enable the the filter row user interface by setting the FilterUIType to FilterRow.
// FilterEvaluationTrigger specifies when UltraGrid applies the filter criteria typed
// into a filter row. Default is OnCellValueChange which will cause the UltraGrid to
// re-filter the data as soon as the user modifies the value of a filter cell.
// By default the UltraGrid selects the type of the filter operand editor based on
// the column's DataType. For DateTime and boolean columns it uses the column's editors.
// For other column types it uses the Combo. You can explicitly specify the operand
// editor style by setting the FilterOperandStyle on the override or the individual
// columns.
//e.Layout.Override.FilterOperandStyle = FilterOperandStyle.Combo;
// By default UltraGrid displays user interface for selecting the filter operator.
// You can set the FilterOperatorLocation to hide this user interface. This
// property is available on column as well so it can be controlled on a per column
// basis. Default is WithOperand. This property is exposed off the column as well.
// By default the UltraGrid uses StartsWith as the filter operator. You use
// the FilterOperatorDefaultValue property to specify a different filter operator
// to use. This is the default or the initial filter operator value of the cells
// in filter row. If filter operator user interface is enabled (FilterOperatorLocation
// is not set to None) then that ui will be initialized to the value of this
// property. The user can then change the operator as he/she chooses via the operator
// drop down.
// FilterOperatorDropDownItems property can be used to control the options provided
// to the user for selecting the filter operator. By default UltraGrid bases
// what operator options to provide on the column's data type. This property is
// avaibale on the column as well.
// By default UltraGrid displays a clear button in each cell of the filter row
// as well as in the row selector of the filter row. When the user clicks this
// button the associated filter criteria is cleared. You can use the
// FilterClearButtonLocation property to control if and where the filter clear
// buttons are displayed.
// Appearance of the filter row can be controlled using the FilterRowAppearance proeprty.
// You can use the FilterRowPrompt to display a prompt in the filter row. By default
// UltraGrid does not display any prompt in the filter row.
// You can use the FilterRowPromptAppearance to change the appearance of the prompt.
// By default the prompt is transparent and uses the same fore color as the filter row.
// You can make it non-transparent by setting the appearance' BackColorAlpha property
// or by setting the BackColor to a desired value.
// for smart datetime filters
e.Layout.Bands["Weights"].Columns["Timestamp"].FilterOperatorLocation = FilterOperatorLocation.Hidden;
// By default the prompt is spread across multiple cells if it's bigger than the
// first cell. You can confine the prompt to a particular cell by setting the
// SpecialRowPromptField property off the band to the key of a column.
//e.Layout.Bands["Weights"].SpecialRowPromptField = e.Layout.Bands["Weights"].Columns[0].Key;
// Display a separator between the filter row other rows. SpecialRowSeparator property
// can be used to display separators between various 'special' rows, including for the
// filter row. This property is a flagged enum property so it can take multiple values.
//e.Layout.Override.AllowAddNew = AllowAddNew.FixedAddRowOnBottom;
e.Layout.Override.AllowUpdate = DefaultableBoolean.True;
// sorting properties
// display cell text on multiple lines
e.Layout.Override.CellMultiLine = DefaultableBoolean.True;
// turn row selectors on for band 0
// init transfer's bands if used
//value editors
editor.EditAs = Infragistics.Win.UltraWinMaskedEdit.EditAsType.UseSpecifiedMask;
editor.DataMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.IncludeLiterals;
editor.DisplayMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.IncludeLiterals;
// Set the mask modes. This only effects columns that use EditorWithMask or derived editors.
e.Layout.Bands["Transfers"].Columns["Timestamp"].Width = 150;
// The FoodTypeID and LossTypeID
// columns should display the name, not the ID.
// We can use a ValueList to accomplish this
e.Layout.Bands["Transfers"].Columns["SiteID"].ValueList = this.gridViewWaste.DisplayLayout.ValueLists["SiteNames"];
e.Layout.Bands["Transfers"].Override.RowSelectors = DefaultableBoolean.True;
By commenting different lines in InitializeLayout method I found out that the problem was caused by following line:
When I commented this line RED CROSS disappeared and now my application scrolling correctly to the right.
That's odd. What version of the grid are you using? Do you have the latest Hot Fix?
If that doesn't help, you should Submit an incident to Infragistics Developer Support and include a small sampe project demonstrating the exception so they can check it out.