本文整理匯總了C#中System.Web.UI.WebControls.ListItemCollection.FindByValue方法的典型用法代碼示例。如果您正苦於以下問題:C# ListItemCollection.FindByValue方法的具體用法?C# ListItemCollection.FindByValue怎麽用?C# ListItemCollection.FindByValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。
在下文中一共展示了ListItemCollection.FindByValue方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: if
ListItem myListItem = SearchType.SelectedItem;
ListItem crItem = null;
String searchText = TextBox1.Text;
if(myListItem.Value == "Name")
{
if(TextBox1.Text != "")
{
String searchSubfir = searchText.Substring(0,1);
String searchSubsec = searchText.Substring(1);
searchText = searchSubfir.ToUpper()+searchSubsec.ToLower();
// Search by country or region name.
crItem = ItemCollection.FindByText(searchText);
}
}
else
{
// Search by country or region code.
crItem = ItemCollection.FindByValue(searchText.ToUpper());
}
String str = "Search is successful. Match is Found.<br />";
str =str + "The results for search string '" + searchText + "' are:<br />";
str = str + "the country or region code is " + crItem.Value + "<br />";
str = str + "the country or region name is " + crItem.Text;
// Add the string to the label.
Label1.Text = str;