Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
947
Exceptions when Removing Unbound Columns on RunTime
posted

Hi,

 When I use any of the two below methods to remove unbound columns, the following exceptions are thrown.

Grid.DisplayLayout.Bands[0].Columns.ClearUnbound();

or

Grid.DisplayLayout.Bands[0].Columns.Remove("UnBoundColumn1");

 System.ArgumentOutOfRangeException occurred
  Message="Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index"
  Source="mscorlib"
  ParamName="index"
  StackTrace:
       at System.Collections.ArrayList.get_Item(Int32 index)
  InnerException:

But, the above exception is not thrown when there was no unbound column added, and called ClearUnbound().

Therefore, is there something wrong about how I add the unbound column, or how I remove in the above code?

(Note: Grid is bound to BindingSource)

And, I see that TotalBoundColumn is has the following exception as well.

TotalBoundColumns = 'Grid.DisplayLayout.Bands[0].Columns.TotalBoundColumns' threw an exception of type 'System.ArgumentOutOfRangeException'

  • 45049
    posted

    Are you putting your columns into groups?  If so, the following thread might provide a solution:
    http://forums.infragistics.com/forums/p/12504/46528.aspx

    If you're not using groups, then I suggest you submit a support request so that a Developer Support Engineer can assist further.  It will help significantly if you attach a sample project that we can run and debug that reproduces this behavior.

    Does the TotalBoundColumns property throw an exception even if you don't try to remove any unbound columns?  If so, then this is likely a separate issue, so please submit a separate support request for that.  This way, we can research and address each issue independently, which makes it easier for both you and us to track the current status of the issues and what the next step is for each.