Hi there,
I know there's no RowDataBound event for the WinForms DataGridView. But there is CellFormatting event in WinForms DataGridView. So Cellformatting event is very very slow.
Is there any solutions like RowDataBound event in WinForms DataGridView (Other then Cellformatting) ?
Thanks for all.

5 answers
Well, as far as I can see, CellFormatting is the only event of the DataGridView which is remotely similar to the RowDataBound event of the GridView, so I don't think there are any other options.
It's fired each time a cell is repainted and so does tend to be slow.
However, there are a couple of 'common sense' performance tips in the MSDN documentation:
1. Avoid lengthy processing in the eventhandler.
2. Always access the cell through the DataGridViewCellFormattingEventArgs parameter rather than directly.
answered one year ago by:
17279
412
Not only this... I found that I was trying to copy thre cells from Excel into three cells of my DGV, and this Darn thing will not accept it. The DGV is does not allows Paste.
Its a bullshit! How there isnt any other options. Only i wanna do like this;
a cell value is 0 or 1 (its coming database)
If the value is "0" grid should be write "yes" (it doesnt see 0)
If the value is "1" grid should be write "no" (it doesnt see 1)
I hope i was explained it.
Thanks.
answered one year ago by:
0
Well, I don't know how you're doing it at the moment but, if the cells are in the 4th column (i.e. ColumnIndex == 3), I'd suggest you handle the CellFormatting event as follows:
answered one year ago by:
17279
Another alternative is change it in the query that pulls from the database or in the original data table.
I'm not sure how you are getting the data or what you are doing with it, but if it is sql you can modify the select statement to return Yes or No instead of 1 or zero
Select Case When Myfield = 0 then 'Yes' else 'No' as CellValue from MyTable
Or depending on the table size, you might try to loop through the data table before you bind it to the datagridview. that way you are only updating it one time all at once not every time you repaint each cell.
answered one year ago by:
196
Youre right @spotsknight. I can modify the select statement to return Yes or No instead of 1 or zero to SQL string. But i cant do it. Its a complicated and mixed form.
my main SQL string is;
And then my formatting is;
My new opinion in this issue. I can use SQL View (and i can format my table how i want it. It will be fast then DataGridViewCellFormatting event)
I hope i was explained it.
Thanks for all.
answered one year ago by:
0