0

I have a menu with data source as sitemap. Which is working fine. I need to add few option based on contents. First, if external link, add "Target=_blank" and add a second css class, which will show a popup message for warning. So I added MenuItemDataBound event which is working for "Target=_blank", since I see the target property and able to set in event. But how can I add second css class. If add second css class to DynamicMenuItemStyle-CssClass property, which applies to all menu items.

<asp:Menu ID="mnu1" runat="server" DataSourceID="smdsMenu1" Orientation="Horizontal"
      DynamicMenuStyle-CssClass="MenuStyle" ItemWrap="true" DynamicMenuItemStyle- CssClass="MenuItem"
      DynamicHoverStyle-CssClass="MenuItemHighlight" OnMenuItemDataBound="Menu_MenuItemDataBound" >

     Protected Sub Menu_MenuItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs)
If CType(e.Item.DataItem, SiteMapNode)("urltarget") <> "" Then
  e.Item.Target = CType(e.Item.DataItem, SiteMapNode)("urltarget")
End If
End Sub

In Event function, I accomplish the external links opening in new windows, by "e.Item.Target", but there is no property for setting CssClass.

Zia
  • 7
  • 1
  • 4

0 Answers0