Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

<%# Eval("State") %> or <%# DataBinder.Eval(Container.DataItem, "state")%>

What is the difference between having

<%# Eval("State") %> 

in your aspx page, versus having

<%# DataBinder.Eval(Container.DataItem, "State") %> 

in your aspx page?

like image 285
Xaisoft Avatar asked Nov 06 '08 20:11

Xaisoft


People also ask

What is <% used for?

<% ... %> is used to embed some java code within the main service() method of the JSP. It is executed during the rendering of the page. <%! ...

What does <% %> mean in JSP?

<%@ is the directive attribute. You may include a page or may declare a tag-library using <%@

What is %> in HTML?

Summary. The new <%: %> syntax provides a concise way to automatically HTML encode content and then render it as output. It allows you to make your code a little less verbose, and to easily check/verify that you are always HTML encoding content throughout your site.

What are JSP tags?

In this JSP tags are used to insert JAVA code into HTML pages. It is an advanced version of Servlet Technology. It is a Web based technology helps us to create dynamic and platform independent web pages. In this, Java code can be inserted in HTML/ XML pages or both.


2 Answers

Eval("State") is a simplified form of the DataBinder.Eval(Container.DataItem, "State") syntax. It only works inside of data-bound template controls.

For more info, see the MSDN documentation.

like image 68
Jeromy Irvine Avatar answered Sep 27 '22 19:09

Jeromy Irvine


There is no difference. The "Eval" method is just a shortcut for the DataBinder.Eval(Container.DataItem, "blah") method.

like image 21
Timothy Khouri Avatar answered Sep 27 '22 19:09

Timothy Khouri