For example, we want to take a date type of data, in the database column name is updated, the value is 2008/06/01. But like the June 01, 2008 show, we can write bind ("updated", "{0:yyyy mm month DD Day}"), and so does eval.
All 2 can read the
In fact, the Eval method is TemplateControl, while the System. web. UI. page and System. web. UI. userControl inherits from TemplateControl, so we can directly call a method on Page and UserControl.
The Page. Eval method can help us better write
Original: The eval () method in JavaScript transforms a JSON object1. For the JSON string returned by the server, if the jquery asynchronous request does not make a type description, or is accepted as a string, then an object processing is required,
1, the Eval method can only be used in the non-strict mode, in use strict is not allowed this method. 2. The eval function receives a parameter s, and if S is not a string, it returns s directly. Otherwise, the S statement is executed. If the S
1, the Eval method can only be used in the non-strict mode, in use strict is not allowed this method.2. The eval function receives a parameter s, and if S is not a string, it returns s directly. Otherwise, the S statement is executed. If the S
asp.net
In fact, the Eval method is TemplateControl, and System.Web.UI.Page and System.Web.UI.UserControl all inherit from TemplateControl, so we can call a method directly on page and UserControl.
The Page.eval method can help us write data-binding
Definition and usageThe eval () function computes a string and executes the JavaScript code in it.GrammarEval (String)Where the parameter string is required. is the string to evaluate that contains the JAVASCRIPT expression to be evaluated or the
Databinder. Eval has three parameters: the name container of the data item, the name of the data field, and the formatted string.
In the template list, such as datalist, DataGrid, or repeater, the named container always container. dataitem.
1. In JS, the eval () method converts the string format data into a date formatfunction GetDate (strdate) {//strdate is a string that needs to be converted to a date format var date = eval (' New date (' + Strdate.replace ') (/\d+ (? =-[^ -]+$)/,
Eval (String)The eval function receives a parameter string, and if string is not a string, the string is returned directly. Otherwise, a string statement is executed. Returns this value if the string statement execution result is a value, otherwise
For eval optimization, we need to use the eval method to achieve inefficiency:
Obtain the expected value based on some specified calculation formulas.
Example:
// The provided data source $ row = array ('pv' => 50, 'u' => 6, 'st' => 650, 'nuv'
Check JScript code and execute.
Eval (codestring)
Required codestring parameter is a string value that contains valid JScript code. This string will be parsed and executed by the JScript parser.
Description
The Eval function allows for dynamic
Js|jscript check JScript code and execute.
Eval (codestring)
Required codestring parameter is a string value that contains valid JScript code. This string will be parsed and executed by the JScript parser.
Description
The Eval function allows
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. Data binding syntax in 1.x '/ >2.2.x simplified eval data binding syntax '/>3. Method overloading of the second method ' >4. Eval binds two values at a time ' >The Eval_r () method uses reflection to perform late-bound computations at run time,
eval can not define the problem of variables to do, there is a good solution, you can refer to the following The code is as follows: eval.asp : http://msdn.microsoft.com/zh-cn/library/8e4z2w8w (v=vs.90) on Jscript8.0 on Microsoft's official
Copy Code code as follows:
Eval.asp
Run Result:
1
2
3
Eval01.aspx
The third line has a syntax error!
You can resolve the problem of defining a variable by a table field by dynamically adding a property to an empty object:
Table
Copy codeThe Code is as follows:Eval. aspRunning result:123Eval01.aspxThe third line has a syntax error!You can dynamically add attributes to an empty object to solve the problem of defining variables by table fields:Table Name: TF1 int,F2 char (10 )
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
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.