Personal notes on software development.
For Java technologies check my dedicated site

Pages

<div id="navigation">
    <ul>
        <li>
            <asp:HyperLink runat="server" ID="lnkHome" 
             NavigateUrl="~/Default.aspx" Text="Home" />
        </li>
        <asp:Repeater ID="menu" runat="server" DataSourceID="SiteMapDataSource1">
            <ItemTemplate>
                <li>
                    <asp:HyperLink runat="server" 
                     NavigateUrl='<%#Eval("url") %>' Text='<%# Eval("title") %>' />
                    <asp:Repeater runat="server" 
                     DataSource='<%# ((SiteMapNode) Container.DataItem).ChildNodes %>'>
                        <HeaderTemplate>
                            <ul>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <li>
                                <asp:HyperLink ID="HyperLink1" runat="server" 
                                 NavigateUrl='<%#Eval("url") %>' Text='
                                 <%# Eval("title") %>' />
                            </li>
                        </ItemTemplate>
                        <FooterTemplate>
                            </ul>
                        </FooterTemplate>
                    </asp:Repeater>
                </li>
            </ItemTemplate>
        </asp:Repeater>
    </ul>
    <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" 
     ShowStartingNode="false" />
</div> 

Note:
The __VIEWSTATE form field generated by the master page adds roughly 1,800 bytes to the page's generated markup. This extra bloat is due primarily to the Repeater control, as the contents of the SiteMapDataSource control are persisted to view state. While an extra 1,800 bytes may not seem like much to get excited about, when using a GridView with many fields and records, the view state can easily swell by a factor of 10 or more.
View state can be disabled at the page or control level by setting the EnableViewState property to false, thereby reducing the size of the rendered markup.
Related articles:
[1] - Master Pages and Site Navigation

No comments:

Post a Comment