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.