Sunday, August 29, 2010

How to remove asp.net menu item using java script and jQuery

<%@ Page Language="C#" %>
<html>
<head id="Head1" runat="server">
    <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script language="javascript">
        $(document).ready(function () {
            $(".Hide").parent().remove();
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div class="Container">
        <asp:SiteMapDataSource runat="server" ID="smdDataSource" ShowStartingNode="false" />
        <asp:Menu runat="server" ID="menuItems" DataSourceID="smdDataSource">
            <DynamicItemTemplate>
                <asp:HyperLink runat="server" ID="menuLink" 
                    Text='<%# Eval("Text") %>' 
                    NavigateUrl='<%# Eval("NavigateUrl") %>'                          
                    CssClass='<%# (Eval("NavigateUrl").ToString()).Contains("HiddenPage.aspx")? "Hide" : "Normal" %>'
                 />
            </DynamicItemTemplate>
        </asp:Menu>
    </div>
    </form>
</body>
</html>

No comments:

iPhone Launch Screen Sizes

iPhone Portrait iOS 8 Retina HT 5.5 = 1242 X 2208 Retna HD 4.7 = 750 X 1134 iPhone Landscape iOS 8 Retina HD 5.5  2208 X 1242 iPho...