Sunday, March 26, 2006

No DataBind( ) call needed for GridView

I was coding gridview for the first time today, then I realized I didn't need to call Page.DataBind() for the data-binding to occur.
Turns out that "databinding expressions are resolved automatically during the control's PreRender event and you are not required to call the DataBind method explicitly." - according to MSDN.

So what's the difference between Bind( ) and Eval( )?
Use Bind( ) if you need a two-way link, which essentially means if your control is updateable.

A good article on databinding can be found here:
http://msdn2.microsoft.com/en-us/library/ms178366(VS.80).aspx

0 Comments:

Post a Comment

<< Home