Click here to Skip to main content
15,896,111 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
ASP.NET
<asp:Menu ID="Menu1" DataSourceID="xmlDataSource" runat="server" 
          BackColor="#F7F6F3" DynamicHorizontalOffset="5" Font-Names="Verdana" 
          ForeColor="#7C6F57" StaticSubMenuIndent="10px" Autopostback="True" 
            Font-Size="0.8em" Height="21px" Orientation="Horizontal">
           <staticselectedstyle backcolor="#5D7B9D" />
           <staticmenuitemstyle horizontalpadding="5px" verticalpadding="2px" />
           <dynamichoverstyle backcolor="#7C6F57" forecolor="White" />
           <dynamicmenustyle backcolor="#F7F6F3" />
           <dynamicselectedstyle backcolor="#5D7B9D" />
           <dynamicmenuitemstyle horizontalpadding="5px" verticalpadding="2px" />
          <databindings>
            <asp:MenuItemBinding DataMember="MenuItem" 
             NavigateUrlField="NavigateUrl" TextField="Text"  ToolTipField="ToolTip"/>;
          </databindings>
           <statichoverstyle backcolor="#7C6F57" forecolor="White" />
         <asp:XmlDataSource ID="xmlDataSource" TransformFile="~/TransformXSLT.xsl"  
          XPath="MenuItems/MenuItem" runat="server>



using above coding the data getting from database when i click menu the appropriate url should visible ., but in above coding its not working.


TransformXSLT.xsl

HTML
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" indent="yes" encoding="utf-8" />
  <xsl:template match="/Menus">
    <menuitems>
      <xsl:call-template name="MenuListing" />
    </menuitems>
  </xsl:template>
 <xsl:template name="MenuListing">
    <xsl:apply-templates select="Menu" />
  </xsl:template>
  
  <xsl:template match="Menu">
    <menuitem>
           <xsl:attribute name="Text">
        <xsl:value-of select="Text" />
      </xsl:attribute>
      <xsl:attribute name="ToolTip">
        <xsl:value-of select="Description" />
      </xsl:attribute>
      <xsl:attribute name="NavigateUrl">
       
      <xsl:text>?Sel=</xsl:text>
        <xsl:value-of select="Text" />
      </xsl:attribute>
    <xsl:if test="count(Menu) > 0">
        <xsl:call-template name="MenuListing" />
      </xsl:if>
    </menuitem>
  </xsl:template>
</xsl:stylesheet>
Posted
Updated 3-Aug-12 0:11am
v4
Comments
Aditya Mangipudi 3-Aug-12 15:22pm    
Are you sure its the asp code and not the .xsl. For example when i look at it i noticed this

match="/Menus"
match="Menu"

Do you see any difference?
Christian Graus 3-Aug-12 18:12pm    
What does 'not working' mean ? What is happening ?

Check out the URL's Path in your database.
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900