//选中选项
public void SelectListIndex(ref ListControl wc, string textOrValue, bool isText)
{
string tempType = wc.GetType().ToString();
tempType = tempType.Replace("System.Web.UI.WebControls.", "").ToLower();
if (tempType == "listbox")
{
if (isText)
((ListBox)wc).SelectedIndex = ((ListBox)wc).Items.IndexOf(((ListBox)wc).Items.FindByText(textOrValue));
else
((ListBox)wc).SelectedIndex = ((ListBox)wc).Items.IndexOf(((ListBox)wc).Items.FindByValue(textOrValue));
}
else if (tempType == "dropdownlist")
{
if (isText)
((DropDownList)wc).SelectedIndex = ((DropDownList)wc).Items.IndexOf(((DropDownList)wc).Items.FindByText(textOrValue));
else
((DropDownList)wc).SelectedIndex = ((DropDownList)wc).Items.IndexOf(((DropDownList)wc).Items.FindByValue(textOrValue));
}
else if (tempType == "radiobuttonlist")
{
if (isText)
((RadioButtonList)wc).SelectedIndex = ((RadioButtonList)wc).Items.IndexOf(((RadioButtonList)wc).Items.FindByText(textOrValue));
else
((RadioButtonList)wc).SelectedIndex = ((RadioButtonList)wc).Items.IndexOf(((RadioButtonList)wc).Items.FindByValue(textOrValue));
}
}