/// <summary>
/// 把ListControl(BulletedList、CheckBoxList、DropDownList、ListBox、RadioButtonList)指定值的行进行选择
/// </summary>
/// <param name="DLTarget">要操作的目标</param>
/// <param name="strValue">值</param>
public static void SelectItemByValue(ListControl DLTarget, string strValue)
{
if (strValue == "")
return;
int iCount = DLTarget.Items.Count;
for (int i = 0; i < iCount; i++)
if (DLTarget.Items[i].Value.Trim() == strValue)
{
DLTarget.SelectedIndex = i;
break;
}
return;
}
/// <summary>
/// 把ListControl(BulletedList、CheckBoxList、DropDownList、ListBox、RadioButtonList)指定名称的行进行选择
/// </summary>
/// <param name="DLTarget">要操作的目标</param>
/// <param name="strName">名称</param>
public static void SelectItemByName(ListControl DLTarget, string strName)
{
int iCount = DLTarget.Items.Count;
for (int i = 0; i < iCount; i++)
if (DLTarget.Items[i].Text == strName)
{
DLTarget.SelectedIndex = i;
break;
}
return;
}