//获得选择的Value值
string topupway = string.Empty;
for (int i = 0; i < cblTopUpWay.Items.Count; i++)
{
if (cblTopUpWay.Items[i].Selected)
{
topupway += cblTopUpWay.Items[i].Value+"|";//这里也可以用逗号(,)
}
}
Response.Write(string.Format("<script>alert('{0}')</script>",topupway));
//根据值选择的进行判断是否选择
string way = "net|168|mobile|mobilecard|card|other|";string checkvalue = string.Empty;
string[] topupway =way.Split('|');
for (int i = 0; i < cblTopUpWay.Items.Count; i++)
{
checkvalue = cblTopUpWay.Items[i].Value;
if (Array.IndexOf<string>(topupway, checkvalue) != -1)
{
cblTopUpWay.Items[i].Selected = true;
}
else
{
cblTopUpWay.Items[i].Selected = false;
}
}