Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
What is the actual difference between DataBound event and RowDataBound event in a grid view?
Is it necessary to use both of them to bind the data or one is enough?
Posted 22-Jul-12 19:33pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi,
Before the GridView control can be rendered, each row in the control must be bound to a record in the data source. The RowDataBound event is raised when a data row (represented by a GridViewRow object) is bound to data in the GridView control. This enables you to provide an event-handling method that performs a custom routine, such as modifying the values of the data bound to the row, whenever this event occurs.
Refer :
MDSN : GridView.RowDataBound Event[^]
MDSN : GridView.OnRowDataBound Method[^]
 
We use gridview DataBound event when we want to do certain things after the server controls bind to the datasource. For example after the binding we may want to display some text at the bottom of the grid or we might want to calculate the total value of a column.
MSDN : GridView.DataBind Method[^]
MSDN : GridView.DataBind Method ()[^]
 
All the best.
--Amit
  Permalink  
v2
Comments
Sandeep Mewara at 23-Jul-12 13:58pm
   
Good answer. 5!
_Amy at 23-Jul-12 14:04pm
   
Thank you Sandeep. :)
reeganto at 17-Apr-14 8:38am
   
Gud one Sandeep.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 340
1 OriginalGriff 210
2 DamithSL 170
3 Kornfeld Eliyahu Peter 130
4 Peter Leow 95
0 OriginalGriff 7,315
1 DamithSL 5,199
2 Sergey Alexandrovich Kryukov 4,917
3 Maciej Los 4,866
4 Kornfeld Eliyahu Peter 4,514


Advertise | Privacy | Mobile
Web03 | 2.8.141223.1 | Last Updated 23 Jul 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100