DataBinder.GetIndexedPropertyValue Method (Object, String)

 

Retrieves the value of a property of the specified container and navigation path.

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

public static object GetIndexedPropertyValue(
	object container,
	string expr
)

Parameters

container
Type: System.Object

The object reference against which expr is evaluated. This must be a valid object identifier in the specified language for the page.

expr
Type: System.String

The navigation path from the container object to the public property value to place in the bound control property. This must be a string of property or field names separated by periods, such as Tables[0].DefaultView.[0].Price in C# or Tables(0).DefaultView.(0).Price in Visual Basic.

Return Value

Type: System.Object

An object that results from the evaluation of the data-binding expression.

Exception Condition
ArgumentNullException

container is null.

- or -

expr is null or an empty string ("").

ArgumentException

expr is not a valid indexed expression.

- or -

expr does not allow indexed access.

The value of expr must evaluate to a public property.

For any of the list Web controls, such as GridView, DetailsView, DataList, or Repeater, container should be Container.DataItem. If you are binding against the page, container should be Page.

.NET Framework
Available since 1.1
Return to top
Show: