1

如果我将 BulletedList Web 控件设置为具有 displaymode="hyperlink",有没有办法以编程方式访问服务器端的超链接?我能得到的最接近它的是父 li 标签,但这不是我需要的。我需要为链接应用一个 css 类,如果我在客户端执行它,我会看到应用类之前和应用之后之间的微小闪烁。

想法?

更新:

<asp:BulletedList ID="List1" runat="server" DisplayMode="HyperLink">
<asp:ListItem Value="http://www.google.com">Go to Google</asp:ListItem>
</asp:BulletedList>


List1.Items[0].Attributes.Add("class", "some_basic_class"); //this applies to the <li> tag
4

1 回答 1

1

Couldn't you just use the CSS selector to select anchor tag inside the list item for which you want to apply the class? So apply the class to the <li> tag, and then use the css selector to modify the anchor tag inside of it.

.selected-li-class a { font-color: red; }
于 2012-02-02T20:03:52.213 回答