Xaisoft
Xaisoft

Reputation: 46591

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?

Upvotes: 36

Views: 46114

Answers (2)

Sam Schutte
Sam Schutte

Reputation: 6736

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.

Upvotes: 9

John Sheehan
John Sheehan

Reputation: 78124

Eval is one-way, read only databinding.

Bind is two-way, read/write databinding.

See here and here.

Upvotes: 51

Related Questions