DataBinder.GetIndexedPropertyValue Method (Object, String, String)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Retrieves the value of the specified property for the specified container, and then formats the results.

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

public static string GetIndexedPropertyValue(
	object container,
	string propName,
	string format


Type: System.Object

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

Type: System.String

The name of the property that contains the value to retrieve.

Type: System.String

A string that specifies the format in which to display the results.

Return Value

Type: System.String

The value of the specified property in the format specified by format.

The GetIndexedPropertyValue method invokes the GetIndexedPropertyValue method, and then uses the String.Format method to format the result as specified in the format parameter. A .NET Framework format string (like those used by String.Format) converts the Object instance returned by the data-binding expression to a String object.

Exceptions that are thrown for the GetIndexedPropertyValue method apply to the GetIndexedPropertyValue method as well.

The following code example demonstrates how to use the GetIndexedPropertyValue method declaratively to bind to an indexed value.

<%# DataBinder.GetIndexedPropertyValue(Container.DataItem, "[0][0]", "{0:c}") %> 

.NET Framework
Available since 1.1
Return to top