Eval vs Bind for ASP.NET

When you start working with ASP.NET sometimes it’s difficult to understand what is the difference between Eval and Bind for data binding controls in ASP.NET.

If you just need to display data on the screen from DataSource, it’s enough to use Eval. It’s something like a read-only method from DataSource.

But if you need to edit data inside of Grid you have to use Bind method because it provides two-way binding. You can read data from DataSource, and you can write data back. Usually you have to use this method if you need to quickly develop a WebPages and display and edit data from one table or simple view.

If you try to modify some rows in Data Grid and want to make changes in the code behind class (OnUdpdating event), data with Eval method will not be available instead of Bind method.


Social media


Latest Tweets