asp.net.ph

ListItemCollection.FindByValue Method

System.Web.UI.WebControls Namespace   ListItemCollection Class


Determines whether the collection contains a specified item.

[ VB ]
Public Function FindByValue ( _
   ByVal value As String _
) As ListItem

[ C# ]
public ListItem FindByValue (
   string value
);

[ C++ ]
public: ListItem FindByValue (
   String* value
);

[ JScript ]
public function FindByValue (
   value : String
) : ListItem;

Parameters

value
The value to search for.

Return Value

A ListItem that contains the value specified by the value parameter.

Remarks

Use the FindByValue method to search the collection for a ListItem with a Value property that contains value specified by the value parameter. If an item is not found in the collection using this criteria, a null reference ( Nothing in Visual Basic ) is returned.

Example

The following examples demonstrate how to use the FindByValue method to programmatically set the Selected property of a ListItem object at run time.

Dynamically Setting the ForeColor and BackColor Properties of a Web Control
Run Sample | View Source
Using a DropDownList in Editable DataList
Run Sample | View Source
Using a DropDownList in Editable DataGrid
Run Sample | View Source
See Also

ListItemCollection Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph