Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between <%# Bind("") %> and <%# Eval("") %> in ASP.NET?

I have seen bind and eval used interchangeably especially in ASP.NET GridViews. What is the difference?

like image 362
Xaisoft Avatar asked Nov 03 '08 16:11

Xaisoft


2 Answers

Eval is one-way, read only databinding.

Bind is two-way, read/write databinding.

See here and here.

like image 119
John Sheehan Avatar answered Oct 07 '22 18:10

John Sheehan


Bind() is used for two-way databinding. So when used with the proper type of datasource, it will pull the altered values out of the GridView or other control, and save them back to the database.

Eval() is a one-way, "read only" way to bind the values.

like image 25
Sam Schutte Avatar answered Oct 07 '22 18:10

Sam Schutte