Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个列表项,我想使用 System.Web.UI.WebControls.Style 设置它的样式,但没有像控件那样的合并样式。有一个 CssStyleCollection 类型的 Attributes.CssStyle 但它不会与 Style 类合并。
ListItem l = list.Items.FindByValue((String)e.Value); if (null != l) { CssStyleCollection csc = AnswerItemStyle.GetStyleAttributes(list); foreach (String key in csc.Keys) { l.Attributes.CssStyle.Add(key, csc[key]); } }
对于那些将来需要它的人。谢谢你的回答,不知道我为什么要问。