title: Need help in arranging Columns in a Multiband Infragistics UltrawinGrid
body: <p>I have a grid which has 4 bands and the columns in band[3] are not arranged in order as in its parent bands. My primary requirement is to arrange the Band[3] columns.
  This is a part of "Export to Excel" code. The grids are already displayed in the form.
  I have tried the below approach -</p>
  
  <pre><code>    private UltraGrid rearrangeCol(UltraGrid grid)
      {
          int bandCount = grid.DisplayLayout.Bands.Count;
          int band = 0;
          List&lt;String&gt; colPos = new List&lt;string&gt;();
          for (int i = grid.DisplayLayout.Bands[band].Columns["EndurEndInv"].Index; i &lt; grid.DisplayLayout.Bands[band].Columns.Count; i++)
          {
              colPos.Add(grid.DisplayLayout.Bands[band].Columns[i].Key);
          }
          band++;
          while (band &lt; bandCount)
          {
              int initialColPos = grid.DisplayLayout.Bands[band].Columns["EndurEndInv"].Index;
              for (int i = initialColPos, j = 0; i &lt; grid.DisplayLayout.Bands[band].Columns.Count &amp;&amp; j &lt; colPos.Count; i++, j++)
              {
                  if(!grid.DisplayLayout.Bands[band].Columns[i].Key.Equals(colPos[j], StringComparison.InvariantCulture))
                  {
                      grid.DisplayLayout.Bands[band].Override.AllowColSwapping = Infragistics.Win.UltraWinGrid.AllowColSwapping.WithinBand;
                      int xcngPos = grid.DisplayLayout.Bands[band].Columns[colPos[j]].Index;
                      grid.DisplayLayout.Bands[band].Columns.Insert(i, "Temp");
                      grid.DisplayLayout.Bands[band].Columns[xcngPos + 1].Swap(grid.DisplayLayout.Bands[band].Columns[i]);
                      grid.DisplayLayout.Bands[band].Columns.Remove("Temp");
                      grid.DisplayLayout.Bands[band].Override.AllowColSwapping = Infragistics.Win.UltraWinGrid.AllowColSwapping.Default;
  
                  }
                  else
                      continue;
              }
              band++;
  
          };
          return grid;
      }
  </code></pre>
  
  <p>Actually, nothing happens when I use SWAP, the keys, index remains same.
  Is there any better approach?</p>