Code highlighting produced by Actipro Codehighlighter (freeware) http://www.codehighlighter.com/-->, first of all, a simple understanding .eval can execute a string generation statement, similar to the SQL exec (). What are the use cases for eval?
Eval () methodDuring runtime, reflection is used to perform post-binding computation. Therefore, compared with the standard ASP. NET data binding method bind, performance will be significantly reduced. It is generally used to format strings when
1. Bind isBidirectional data binding, Will change only when there is a data source.
2. In net1.x, there are databinder (container. dataitem, "data item ")One-way Data Binding
. Net2.x is simplified to eval ("data item ");
The difference
Statement:
First of all, I am a newbie to JS, So I dare not go into depth. I just share my recent eval learning experience with you. If you are a master, I can skip it.
Suitable for readers:
I have no idea how eval converts a string to a JSON
Eval () methodLate-bound calculations are performed using reflection at run time, so performance is significantly reduced compared to the standard ASP. NET data binding method. It is typically used when binding requires formatting a string. Use this
1. Briefly describe the differences between eval and bind
Binding expressionDifference 1. Eval is read-only data and bind is updatable.2. When performing the next expression operation, you must use eval such as 2. If the content format
The effect of Eval is simply to pass a string to the JS interpreter, which the JavaScript interpreter interprets as JavaScript code and executes it.For the simplest example:
Copy Code code as follows:
Eval ("Alert (1+1)");
Script>
Eval ("") and Bind ("") both a one-way binding, a two-way binding, bind is a two-way binding, but requires data source supportASP. NET 2.0 improves the data binding operation in the template, simplifying the data binding syntax DataBinder.Eval
'/> '/>
Differences between eval and bind
To put it simply:
Binding expression1. Eval one-way binding: data is read-onlyBind two-way binding: the data can be changed and returned to the server. The server can process the changed data, such
The eval () method uses reflection to perform post-Binding Calculations at runtime. Therefore, compared with the standard ASP. NET data binding method, this causes a significant reduction in performance. It is generally used to format strings when
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.