I have a little bit of trouble figuring out why I am getting these error messages. Here is the error messages and then the code will follow behind it.The code is taken directly out of the book "ASP.NET 2.0 Everyday Applications for DUMMIES". Any help is greatly appreciated. Thank you.
--------------------------------------------------------------------------------line--column--------------
Error 13 Name 'ForumRepeater' is not declared. 37 9
Error 14 Name 'ForumRepeater' is not declared. 39 9
Error 15 Handles clause requires a WithEvents variable defined in the containing type or one of its base types. 45 21
Forums/Default.aspx
1 <%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="Forums_Default" %>
2
3 <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
4 <style type="text/css">
5 .style16
6 {
7 width: 100%;
8 }
9 </style>
10 </asp:Content>
11 <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
12 <table border="0">
13 <asp:Repeater ID="ForumRepeater" runat="server">
14 <ItemTemplate>
15 <tr>
16 <td>
17 <asp:Label ID="lblForumName" runat="server" Text='<% #Eval ("name") %>'>
18 </td>
19 </tr>
20 <asp:Repeater ID="TopicRepeater" runat="server">
21 <ItemTemplate>
22 <tr><td>
23 <asp:LinkButton ID="LinkTopicName" runat="server" Text='<% #Eval ("name")%>'
24 PostBackUrl='<% #Eval ("topicid", "Threads.aspx?topic={0}")%>'>
25 --
26 <asp:Label ID="lblTopicDesc" runat="server" Text="<% #Eval ("description") %>">
27 </td></tr>
28 </ItemTemplate>
29 </asp:Repeater>
30 </ItemTemplate>
31 </asp:Repeater>
32 </table>
33 </asp:Content>
34
Forum/Default.aspx.vb
1 Imports System.Web.Configuration
2 Imports System.Data.SqlClient
3 Imports System.Data
4
5 Partial Class Forums_Default
6 Inherits System.Web.UI.Page
7
8 Private ds As DataSet
9
10 Protected Sub Page_Load( _
11 ByVal sender As Object, _
12 ByVal e As System.EventArgs) _
13 Handles Me.Load
14 Dim con As String _
15 = WebConfigurationManager _
16 .ConnectionStrings("ForumConnectionString") _
17 .ConnectionString
18 ds = New DataSet()
19
20 'fill the Forums table
21 Dim sel As String _
22 = "SELECT [forumid], [name] " _
23 + "FROM Forums " _
24 + "ORDER BY [name]"
25 Dim da As SqlDataAdapter _
26 = New SqlDataAdapter(sel, con)
27 da.Fill(ds, "Forums")
28
29 'fil the Topics Table
30 sel = "SELECT [forumid], [topicid], " _
31 + "[name], [description] " _
32 + "ORDER BY [name]"
33 da = New SqlDataAdapter(sel, con)
34 da.Fill(ds, "Topics")
35
36 ' bind the Forum Repeater
37 ForumRepeater.datasource = ds.Tables("Forums") _
38 .DefaultView
39 ForumRepeater.DataBind()
40 End Sub
41
42 Protected Sub ForumRepeater_ItemDataBound( _
43 ByVal sender As Object, _
44 ByVal e As RepeaterItemEventArgs) _
45 Handles ForumRepeater.ItemDataBound
46 Dim r As Repeater
47 r = e.Item.FindControl("TopicRepeater")
48
49 Dim drv As DataRowView
50 drv = e.Item.DataItem
51 Dim forumid As String = drv("forumid")
52
53 Dim dv As DataView
54 dv = ds.Tables("Topics").DefaultView
55 dv.RowFilter = "forumid=" + forumid
56
57 r.DataSource = dv
58 r.DataBind()
59 End Sub
60 End Class
61