Home   Preview the Book   Chapter 15, TOC   Part 13

  Previous: Using Graphics in a Header Control
  Next: Developing a Control for the Navigation Menu

Developing a Localized Footer Control

The bottom section of the right-hand side of each VB Snippets page (look back at Figure 15-5) contains a footer that displays business information and links. This user control is localized using the same code that you use to localize a Web page. Listing 15-3 contains the localized ASCX code for this control.

Listing 15-3. The u_code_foot.ascx User Control

<%@ Control Language="vb" AutoEventWireup="false" 
    Codebehind="u_code_foot.ascx.vb" 
    Inherits="Chapter_15.u_code_foot" 
    TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<p class="footertopic">© 2002 
    <a class="footer" 
        href="http://www.smartisans.com">SoftMedia Artisans, Inc.</a> 
    <%=rm.GetString("CodePermission")%> 
    <a class="footer" href="terms_of_use.htm">
        <%=rm.GetString("TermsOfUse")%></a> 
    <%=rm.GetString("forDetails")%>
</p>

Styles provided by the Web designer control the font, size, and color of the text displayed in the u_code_foot user control, as well as the background and link colors. Listing 15-4 shows the complete code behind this user control. As you see, the only code requirement is to supply the ResourceManager instance required for localization.

Listing 15-4. The u_code_foot.ascx.vb User Control Code

Protected rm As ResourceManager

Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
    'Put user code to initialize the page here
    rm = New ResourceManager("Chapter_15.strings", GetType(index).Assembly)
End Sub

Although useful, the logo and footer user controls don’t offer much programming challenge. The navigation menu control, although still fairly simple, varies its display from page to page. Let’s look at it now.

  Previous: Using Graphics in a Header Control
  Next: Developing a Control for the Navigation Menu

Home   Preview the Book   Chapter 15, TOC   Part 13

Copyright © 1996 - 2017 SoftMedia Artisans, Inc. All Rights Reserved.