Click here to Skip to main content
15,921,577 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my page i am using gridview1 for that i am RowCommand(), RowDatabound() and Databound().my dought is. Is it Necessary to use RowDatabound() and Databound().cant we use sigle one like RowDatabound() and we cant achieve same functionality like Databound()
Posted
Comments
vijay__p 9-May-13 0:41am    
DataBound happens after each and every RowDataBound event is fired, and therefore only fires once for the control. If you only have one thing to do, put it in the DataBound method. If it's something that needs to happen on an arbitrary row, do it in RowDataBound.
ntitish 9-May-13 2:01am    
actualy the grid i used for displaying messages in inbox...for one message i am binding received date and sending date,username,image etc...,so can i take rowdatabound for that..

1 solution

See the similar answer I've given here:
DataBound and RowDataBound[^]

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 ()[^]

Hope now it's clear to you. :)
--Amit
 
Share this answer
 
v2
Comments
Thanks7872 9-May-13 1:10am    
↑ voted.it deserves 5..!
_Amy 9-May-13 1:19am    
Thank you Rohan. :)

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900