变量怎么赋给控件名称...
string kindid = ConvertStrID(seltypes);
string[] strKind = dr[ "province "].ToString().Trim().Split(new char[] { ', ' }); //拆分字符串
for (int i = 0; i < strKind.Length; i++)
{
for (int j = 0; j < kindid.Items.Count; j++)
{
if (strKind[i].Trim() == kindid.Items[j].Value.Trim())
{
kindid.Items[j].Selected = true;
}
}
}
提示错误:
编译器错误信息: CS0117: “string”并不包含“Items”的定义
出错的原因是kindid没有被ConvertStrID(seltypes)赋值
kindid并非是控件名称,而是kindid的值才是控件名称,这里怎么解决
------解决方案--------------------kindid是string类型
kindid.Items能对吗?
------解决方案--------------------findControl()