XPathBinder.Eval Method (Object, String, IXmlNamespaceResolver)


Evaluates XPath data-binding expressions at run time and formats the result as text to be displayed in the requesting browser, using the IXmlNamespaceResolver object specified to resolve namespace prefixes in the XPath expression.

Namespace:   System.Web.UI
Assembly:  System.Web (in System.Web.dll)

public static object Eval(
	object container,
	string xPath,
	IXmlNamespaceResolver resolver


Type: System.Object

The IXPathNavigable object reference that the expression is evaluated against. This must be a valid object identifier in the page's specified language.

Type: System.String

The XPath query from the container to the property value to be placed in the bound control property.

Type: System.Xml.IXmlNamespaceResolver

The IXmlNamespaceResolver object used to resolve namespace prefixes in the XPath expression.

Return Value

Type: System.Object

A Object that results from the evaluation of the data-binding expression.

You can use the Eval method declaratively if you want to simplify the casting of an XML node to a text string to be displayed in a browser. To do so, you must place the <%# and %> tags, which are also used in standard ASP.NET data binding, around the data-binding expression. The data-binding expression includes the XPath expression and an IXmlNamespaceResolver object to resolve the namespace reference.

For any of the list ASP.NET server controls, such as DataList, DataGrid, or Repeater, the container parameter should be Container.DataItem. If you are binding against the page, the container parameter should be Page.

.NET Framework
Available since 2.0
Return to top