Home > ASP.NET > C#: How to check if value exists in DropDownList

C#: How to check if value exists in DropDownList

16:15

Marek Śliwiński Leave a comment Print This Post  (771) Go to comments
//Tested on .NET 2.0

public static bool IsValueInDropdownList(DropDownList controlName,
string strValue)
{
    if (controlName.Items.FindByValue(strValue) != null)
        return true;

    return false;
}
Share and Enjoy:
  • DotNetKicks
  • Digg
  • del.icio.us
  • Wikio IT
  • Google Bookmarks
  • Facebook
  • Print
Categories: ASP.NET Tags: ,
  1. No comments yet.
  1. No trackbacks yet.

Subscribe without commenting