bigmoxy
asked on
What is wrong with this code declaration?
Could someone please tell me why the vbc (2.0 framework) complains that rptLinks is not declared when in fact it is declared in the repeater statement? I get a similar error in VS 2008.
<%@ Control Language="vb" AutoEventWireup="false" Codebehind="Categories.ascx.vb" Inherits="keepsake.Categories1" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<font face="arial" size="2">
<asp:Repeater ID="rptLinks" Runat="server">
<ItemTemplate>
<a href='quinceanera.aspx?cat_id=<%# DataBinder.Eval(Container.DataItem, "cat_id")%>'><%# DataBinder.Eval(Container.DataItem, "cat_name")%></a><br>
</ItemTemplate>
<FooterTemplate>
<br>
</FooterTemplate>
</asp:Repeater>
</font>
---------------------------------------------
Imports System.Data.SqlClient
Namespace keepsake
Partial Class Categories1
Inherits System.Web.UI.UserControl
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If (Not Page.IsPostBack) Then
Dim objConn As SqlConnection = New SqlConnection(System.Configuration.ConfigurationManager.AppSettings("ConnectionString"))
Dim objCommand As SqlCommand = New SqlCommand
Dim objReader As SqlDataReader
objCommand.CommandText = "SELECT * FROM Categories ORDER BY cat_name"
objCommand.Connection = objConn
objConn.Open()
rptLinks.DataSource = objCommand.ExecuteReader
rptLinks.DataBind()
objConn.Close()
objCommand.Dispose()
objCommand = Nothing
objConn.Dispose()
objConn = Nothing
End If
End Sub
End Class
End Namespace
ASKER
No, I get the same error:
c:\websites\quinceaneragal lery.com\C ategories. ascx.vb(37 ) : error BC30451: Name
'rptLinks' is not declared.
c:\websites\quinceaneragal
'rptLinks' is not declared.
There's nothing wrong with the declaration. I know VS2008 shows some carzy messages when they are acctually not. Possibility is there might be some other errors in the page. Are you seeing any other errors along with this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window