What's the difference between <#eval and <#bind in asp.net

前端 未结 7 871
天命终不由人
天命终不由人 2020-12-31 01:09

In a gridview, we can use <%#Eval%> or <%#Bind%> to output values from a database. What is the difference between them?

7条回答
  •  天命终不由人
    2020-12-31 01:57

    Eval does one-way binding; Bind is two-way.

    If you bind a value using Eval, it is read-only. You can only view the data.

    If you bind a value using Bind, changes to values will be reflected in the database as well.

    You can refer to this similar post here on stack overflow: What is the difference between <%# Bind("") %> and <%# Eval("") %> in ASP.NET?

提交回复
热议问题