<%@ Page Language="vb" %>
<%@ Register TagPrefix="MyTag" TagName="Header" Src="header_CB.ascx" %>
<%@ Register TagPrefix="MyTag" TagName="FeaturedBooks" Src="FeaturedBooks.ascx" %>
User Control Examples
<%-- header_CB.ascx
<%@ Control inherits="HeaderClass" src="header_CB.vb" %>
cellspacing="0">
Welcome to the shop!
Select your Language:
OnSelectedIndexChanged="DropList_Changed" AutoPostBack="True"/>
--%>
<%-- header_CB.vb
Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Collections
Public Class HeaderClass : Inherits UserControl
Private Languages As New Hashtable()
Public LanguageList As DropDownList
Public WelcomeMessage As Label
Public Sub Page_Load()
Languages.Add("English", "Hello, and welcome to the shop")
Languages.Add("French", "Bonjour, et bienvenue a le magasin")
Languages.Add("Spanish", "Buenas Dias, e bienvenido a la tienda")
Languages.Add("German", "Guten Tag, und wilkommen ins geschaeft")
If Not Page.IsPostback
LanguageList.Datasource = Languages.Keys
Page.DataBind()
End If
End Sub
Public Sub DropList_Changed(Sender As Object, E As EventArgs)
WelcomeMessage.text = Languages(Languagelist.SelectedItem.Text)
End Sub
End Class
--%>
<%-- FeaturedBooks.ascx
<%@ import Namespace="System.Data" %>
<%
Dim ResultString as String
ResultString = "Today's Featured Books: "
ResultString += ""
ResultString += "fake book data"
ResultString += "
"
Response.Write (ResultString)
%>
--%>