DataBinder.GetIndexedPropertyValue Method (Object, String, String)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com 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
)

Parameters

container
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.

propName
Type: System.String

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

format
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
Show: