XPathBinder::Eval Method (Object, String, String)
Evaluates XPath data-binding expressions at run time and formats the result as text to be displayed in the requesting browser.
Assembly: System.Web (in System.Web.dll)
Parameters
- container
- 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.
- xPath
- Type: System::String
The XPath query from the container to the property value to be placed in the bound control property.
- format
- Type: System::String
A .NET Framework format string, similar to those used by String::Format, that converts the IXPathNavigable object (which results from the evaluation of the data-binding expression) to a String that can be displayed by the requesting browser.
Return Value
Type: System::StringA String that results from the evaluation of the data-binding expression and conversion to a string type.
| Exception | Condition |
|---|---|
| ArgumentNullException | The container or xpath parameter is nullptr. |
| ArgumentException | The object specified by container is not an IXPathNavigable. |
To learn more about format strings in the .NET Framework, see Formatting Types.
You can use the Eval(Object, String) 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.
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.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.