禁用或启用DropDownList的Items(2)
}
private int GetIndexByValue(string value)
{
return this._DropDownList.Items.IndexOf(this._DropDownList.Items.FindByValue(value));
}
private void DisableItems(int index)
{
if (index > -1)
this._DropDownList.Items[index].Attributes.Add("disabled", "disabled");
}
private void EnableItems(int index)
{
if (index > -1)
this._DropDownList.Items[index].Attributes.Remove("disabled");
}
}
}
演示,启用Items:
if (Request.QueryString["site"] != null)
{
InsusDropDownList obj = new InsusDropDownList(this.DropDownList1);
obj.EnableItemsByText(Request.QueryString["site"]);
}
摘自 Insus.NET
相关新闻>>
- 发表评论
-
- 最新评论 更多>>