6 Replies - 18222 Views - Last Post: 14 June 2010 - 12:43 AM Rate Topic: -----

#1 fatix  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 26-May 10

WinForms DataGridView RowDataBound

Posted 26 May 2010 - 08:53 AM

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.
Is This A Good Question/Topic? 0
  • +

Replies To: WinForms DataGridView RowDataBound

#2 FlashM  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 382
  • View blog
  • Posts: 1,195
  • Joined: 03-December 09

Re: WinForms DataGridView RowDataBound

Posted 26 May 2010 - 10:05 AM

What exactly are you trying to do... It's possible that there might be some better solution to your problem than using CellFormating event...
Was This Post Helpful? 0
  • +
  • -

#3 Guest_Jortx*


Reputation:

Re: WinForms DataGridView RowDataBound

Posted 11 June 2010 - 02:28 AM

View PostFlashM, on 26 May 2010 - 09:05 AM, said:

What exactly are you trying to do... It's possible that there might be some better solution to your problem than using CellFormating event...

¿Can you post this better solution you say?
He should be trying something like set the value of a new column:
GridView1.Rows(i).Cells("Total") = GridView1.Rows(i).Cells("Units") * GridView1.Rows(i).Cells("Price")
So, i say CellFormatting is not the best solution.
For example, CellFormatting fires when you click on the Grid... This is no like RowDataBound, sure.
¿Any help?
Thanks a lot.
Was This Post Helpful? 0

#4 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1524
  • View blog
  • Posts: 5,957
  • Joined: 21-March 08

Re: WinForms DataGridView RowDataBound

Posted 11 June 2010 - 04:47 AM

Sadly, there is no optimal way to do a RowDataBound for the DataGridView in WinForms. All of them are slow.

Your other option is to use the DataBindingComplete event for the grid, then loop through all the rows and change the cell data. It's not optimal, but if you have only a few rows(less than 50), then you won't see any slowdown.

This post has been edited by eclipsed4utoo: 11 June 2010 - 04:51 AM

Was This Post Helpful? 0
  • +
  • -

#5 Guest_Jortx*


Reputation:

Re: WinForms DataGridView RowDataBound

Posted 11 June 2010 - 08:42 AM

View Posteclipsed4utoo, on 11 June 2010 - 03:47 AM, said:

Sadly, there is no optimal way to do a RowDataBound for the DataGridView in WinForms. All of them are slow.

Your other option is to use the DataBindingComplete event for the grid, then loop through all the rows and change the cell data. It's not optimal, but if you have only a few rows(less than 50), then you won't see any slowdown.


Thanks man,.
Sure, you can do that, but is very different than use a wonderful event like RowDataBound.
Exactly what i need, is to show the typical summary row at the bottom of the GridView, but i'm finding some posts in other forums that is not easy! I'm very surprised about it. There's not an easy way to show a summary row in the gridview? :wacko:
Was This Post Helpful? 0

#6 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1524
  • View blog
  • Posts: 5,957
  • Joined: 21-March 08

Re: WinForms DataGridView RowDataBound

Posted 11 June 2010 - 08:53 AM

Easy way? not that I know of. It would be great if the RowDataBound event existed in WinForms, but it doesn't.
Was This Post Helpful? 0
  • +
  • -

#7 Guest_Jortx*


Reputation:

Re: WinForms DataGridView RowDataBound

Posted 14 June 2010 - 12:43 AM

Wow... Normally, the things you want to do for WinForms are easier than to do it for WebForms.
This is not the case...
At the moment, I do all the things I need in the datasource, and then, to calculate the summary, y do it iterating each datagrid row. I don't like it, because when the grid have too many rows, sure this will be a slow method.
Thanks for all your replies.
Regards.
Was This Post Helpful? 0

Page 1 of 1