1

In my code below the asp menu item value property is actually rendering as link text!

<asp:Menu ID="menuTop" runat="server" EnableViewState="true" Orientation="Horizontal" StaticSelectedStyle-CssClass="menuselected" SkipLinkText="">
   <Items>
      <asp:MenuItem NavigateUrl="~/Default.aspx" ImageUrl="~/images/Menu_Home.jpg" Value="Home" />
      <asp:MenuItem NavigateUrl="~/Contact.aspx" ImageUrl="~/images/Menu_Contact.jpg" Value="Contact"/>
   </Items>
</asp:Menu>

According to the MSDN reference located at http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.menuitem.value.aspx

The Value property is used to supplement the Text property by storing any additional data associated with the menu item. This value is not displayed in the control and is commonly used to store data for handling postback events.

I need it to store values, why is it displaying as link text?

2 Answers 2

1

Try this code.

<asp:Menu ID="menuTop" runat="server" EnableViewState="true" Orientation="Horizontal" StaticSelectedStyle-CssClass="menuselected" SkipLinkText="">
    <Items>
       <asp:MenuItem NavigateUrl="~/Default.aspx" ImageUrl="~/images/Menu_Home.jpg" Value="Home" Text="" />
       <asp:MenuItem NavigateUrl="~/Contact.aspx" ImageUrl="~/images/Menu_Contact.jpg" Value="Contact" Text=""/>
    </Items>
</asp:Menu>
0

Nevermind, I figured it out. Looks like you need to set the Text value to "" and that prevents the value from displaying as text.

Not the answer you're looking for? Browse other questions tagged or ask your own question.