protected void repCurCity_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
City cit = (City)e.Item.DataItem;
if(cit.CityName.Equals(cityname))
{
HtmlControl hc = (HtmlControl)e.Item.FindControl("a1");
hc.Attributes.Add("class", "cur");
}
}
}
这里的City 是类型List<T>, 也可以是字符串,或者其他类型.