TheGateKeeper
TheGateKeeper

Reputation: 4530

Adding title tag to hyperlinks placed in bulleted list

I have a bulleted list set to BulletedListDisplayMode.HyperLink display mode, and it works fine but I cannot find a way to specify the title tag for each hyperlink. Can this be done?

Thanks!

Upvotes: 1

Views: 445

Answers (2)

Kevin Main
Kevin Main

Reputation: 2344

This is not possible out of the box as under the hood BulletedList binds to a ListItem which does not have any such property.

You can deal with this a few ways -

1) Handle the OnPreRender event, loop through all items and add using Attributes.Add()

2) Create a custom control which inherits from BulletedList and add a title property.

3) Get rid of the BulletList all together and use a Repeater

Personally I would go for 3) as you then have much more flexibility in the output.

Upvotes: 2

csharpnumpty
csharpnumpty

Reputation: 3723

Have you tried using the BulletedList.AddAttributesToRender method?

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.bulletedlist.addattributestorender.aspx

Upvotes: 1

Related Questions