title: C# Grid column right alignment
body: <p>I am using the below code(Partial Code) to get print out of a grid rows. But the last column having the amount.So i want to align the last column as right alignment.But i got the error.</p>
  
  <pre><code>DataTable dt = (DataTable)ViewState["Datasource"];
  DataTable newTable = dt.DefaultView.ToTable(false, "FLD_ID", "FLD_CUST_ID", "FLD_CUST_NAME", "FLD_CUST_ADDR", "FLD_AMT");
  
  newTable.Columns["FLD_ID"].ColumnName = "PAY.ID";
  newTable.Columns["FLD_CUST_ID"].ColumnName = "CUST.ID";
  newTable.Columns["FLD_CUST_NAME"].ColumnName = "CUST.NAME";
  newTable.Columns["FLD_CUST_ADDR"].ColumnName = "ADDRESS";               
  newTable.Columns["FLD_AMT"].ColumnName = "INV.AMOUNT";
  
  
  GridView PrintGrid = new GridView();
  PrintGrid.DataSource = newTable;
  PrintGrid.DataBind();
  PrintGrid.AllowPaging = false;
  
  PrintGrid.Columns[4].ItemStyle.HorizontalAlign = HorizontalAlign.Right;
  //Got Error Index was out of range. Must be non-negative and less than the size of the collection.Parameter name: index.
  </code></pre>
  
  <p>Please help me to solve this.</p>