Memo 3: determines the value of the data binding value.

Source: Internet
Author: User

Memo 3: determines the value of the data binding value.

Yesterday, in a project, we used the Repeater loop to get the value, and then determined based on the value of a field to determine whether to add a style. Previously Used <% # Eval ("Name"). ToString () = name? "Yes": "no" %>, where name is a public string type variable on the. cs page, and Name is a nvarchar (50) type field in the database table. Debugging shows that the data in the data source is actually equal to the name value, but the value is always "no ". Later, the solution Baidu found was changed to: <% # Eval ("Name"). Equals (name )? "Yes": "no" %>, so that the value can be obtained as expected.

Finally:

 

 

Why can I use: <% # Eval ("Name"). Equals (name )? "Yes": "no" %>, but cannot use <% # Eval ("Name"). ToString () = name? "Yes": "no" %>. Do you need to consider the difference between Equals and =?

 

 


71. set definition: int a = 2, B = 3, c = 4; then the expression with the value 0 in the following options is () A (a <B )&&! C | 1 BCD is being added. Well, use True or false to judge whether the value is 0. When the value is 0, the law is false only when the value is 0.
A :( a <B) True c false (true & false) False (false | true) True 0
B: (true & false) False 0
C :( true & True) True 0
D: (true | true) True, c-a true (true & True) True 0

[Select B]
How to judge the value of DataBinderEval using a ternary expression:
<% = (Session ["k"]! = DataBinder. Eval (Container. DataItem, "ID "))? "Filter": "All" %>
**************************************** **
The Container data binding syntax is specific to the context. You need to write the DataListItemTemplate tag.

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.