开发者

ASP.NET BulletedList - Get Selected Item (Javascript)

I have a BulletedList in ASP.NET

<asp:BulletedList ID="lstItems" OnClick="Item_OnClick" DisplayMode="LinkButton" runat="server" />

On the server I handle the list item's link button click event.

When this occurs I want to apply a CSS class to the selected item on the client-side to show that it is the selected item.

Since ListItem does not support any sort o开发者_JAVA百科f CSS properties directly, but does support Selected, I assume the best way to do this would be to get the selected item from control on the page load and apply the styling then.

Does anyone know how to access this property in JavaScript or any other options to achieve this affect?


Sure. On the postback, you can add the attributes you need with "attributes.add"

Your_Control.Attributes.Add("class", "your_class_name")
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜