Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > formatting goes off when a column in datagridview is sorted.
 

formatting goes off when a column in datagridview is sorted.

hi,

I bind a data table to the datagridview and then format the columns after binding the same and it displays to some extent.

1.When i sort the column the formatting of some particulatr column goes off.

2. Before i sorted the column the row alternating style doesnt appear.When i sort the column , row color changes and some formatting goes off.

How to resolve the same.

Thanks,

Aravind

Jangu  Thursday, April 03, 2008 10:17 PM

Hi,

What I guess is that you just set the formatting for the cells after binding, however the formatting will be gone after sorting. To avoid this, you should handle the CellFormatting event to apply the formatting to the cells you want to format, and don't forget to use IF statement to restrict the formatting to be only applied to the cells that need to formatted.

Best Regards

Zhi-xin Ye

Zhi-Xin Ye  Thursday, April 10, 2008 6:45 AM

Hi,

What I guess is that you just set the formatting for the cells after binding, however the formatting will be gone after sorting. To avoid this, you should handle the CellFormatting event to apply the formatting to the cells you want to format, and don't forget to use IF statement to restrict the formatting to be only applied to the cells that need to formatted.

Best Regards

Zhi-xin Ye

Zhi-Xin Ye  Thursday, April 10, 2008 6:45 AM

You can use google to search for other answers

Custom Search

More Threads

• How do I refresh/synch data in a dataset/dataTable with changes from a database?
• Details ComboBox Problem [Fixed]
• How do I stop new rows
• DataGrid throws unhandled exception(Index was outside the bounds of the array.)
• Datagridview RowLeave Exceptions
• .Net Framework 2.0 Windows-Based Client Development Training Kit - Exam 70-526 ISBN-10 0-7356-2333-3
• Combobox is not updating when row is added to DataTable
• Add raws to dataset table via network!
• Rightclick on DataGridView cell?
• Change the color of the SortGlyph