By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,899 Members | 1,190 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,899 IT Pros & Developers. It's quick & easy.

in TablePanelLayout ,when I removed a row, the space occupied doesn't get freed .

P: 15
Here is my code
Expand|Select|Wrap|Line Numbers
  1.  public void DeleteItemRow(int currentRow)
  2.         {
  3.             tblOrderItemDetails.RowStyles.RemoveAt(currentRow);
  4.  
  5.             for (int columnIndex = 0; columnIndex < tblOrderItemDetails.ColumnCount; columnIndex++)
  6.             {
  7.                 var control = tblOrderItemDetails.GetControlFromPosition(columnIndex, currentRow);
  8.                 tblOrderItemDetails.Controls.Remove(control);
  9.             }
  10.  
  11.             for (int i = currentRow + 1; i < tblOrderItemDetails.RowCount; i++)
  12.             {
  13.                 for (int columnIndex = 0; columnIndex < tblOrderItemDetails.ColumnCount; columnIndex++)
  14.                 {
  15.                     var control = tblOrderItemDetails.GetControlFromPosition(columnIndex, i);
  16.                     if (control != null)
  17.                         tblOrderItemDetails.SetRow(control, i - 1);
  18.                 }
  19.             }
  20.             rowCount--;
  21.             tblOrderItemDetails.RowCount--;
  22.  
  23.         }
When I executed this code,it deleted the row (for the user). but internally it didn't. bcoz when I add another row , it gets added to the next row as if the deleted row still exists.

Could someone please answer how to get rid of this ?
May 5 '12 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.