Solved

BC30451 Error

Posted on 2006-11-07
1
414 Views
Last Modified: 2010-04-25
Hi

Im using Dreamweaver 8 to develop aspx file using version 1.1 for dot net framework. I recieving error on line:

Compiler Error Message: BC30451: Name 'ddlGateway' is not declared.

Source Error:
Line 29:                 Dim nodeGateway As XmlNode
Line 30:                 For Each nodeGateway In nodeListGateway
Line 31:                     ddlGateway.Items.Add(New ListItem(nodeGateway.SelectSingleNode("NAME").InnerText, nodeGateway.SelectSingleNode("CODE").InnerText))
Line 32:                 Next
Line 33:                         End If

I have following rropusaspx file:

<%@ Page Language="VB" src="gropus.aspx.vb" Inherits="GroupInfo"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Group</title>
</head>
<body>
<form id="form1" runat="server">
<asp:DropDownList ID="ddlGateway" runat="server" Width="240px" AutoPostBack="True"></asp:DropDownList>
</form>
</body>
</html>



I have the following gropus.aspx.vb file
Imports System
Imports System.Xml
Imports System.Text
Imports System.Net
Imports System.IO
Imports System.String
Imports System.Data
Imports System.Exception
Imports System.Web.UI.WebControls

Class GroupInfo
      Inherits System.Web.UI.Page
      
Public Sub Page_Init()
            'Dim ddlGateway As DropDownList()
            Dim ddlGateway As new DropDownList()
End Sub
      
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
          Try
            If Not Page.IsPostBack Then
                Dim docGateway As XmlDocument = New XmlDocument()
                docGateway.Load(Server.MapPath("//Gateway.xml"))
                Dim nodeListGateway As XmlNodeList = docGateway.SelectNodes("//GATEWAYS/GATEWAY")
                Dim nodeGateway As XmlNode
                For Each nodeGateway In nodeListGateway
                    ddlGateway.Items.Add(New ListItem(nodeGateway.SelectSingleNode("NAME").InnerText, nodeGateway.SelectSingleNode("CODE").InnerText))
                Next
                        End If
        Catch er As XmlException
            Response.Write(er.ToString)
        Catch er As HttpException
            Response.Write(er.ToString)
        Catch er As Exception
            Response.Write(er.ToString)
        End Try
    End Sub
End class


 
0
Comment
Question by:shwaqar82
1 Comment
 
LVL 25

Accepted Solution

by:
Rouchie earned 500 total points
ID: 17889745
This is an ASP.NET question rather than a dreamweaver question, but I'll have a go anyway.
Is there any reason why you are using Page_Init to declare the drop down list when it is already hard-coded into the actual page.

Try this approach if you don't need to declare it on server-side:

Imports System
Imports System.Xml
Imports System.Text
Imports System.Net
Imports System.IO
Imports System.String
Imports System.Data
Imports System.Exception
Imports System.Web.UI.WebControls

Class GroupInfo
     Inherits System.Web.UI.Page
     
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
      If Not Page.IsPostBack Then
            getListDataFromXML()
      End If
End Sub


Protected Sub getListDataFromXML()
      Try
            Dim docGateway As XmlDocument = New XmlDocument()
            docGateway.Load(Server.MapPath("//Gateway.xml"))
            Dim nodeListGateway As XmlNodeList = docGateway.SelectNodes("//GATEWAYS/GATEWAY")
            Dim nodeGateway As XmlNode
            For Each nodeGateway In nodeListGateway
                  ddlGateway.Items.Add(New ListItem(nodeGateway.SelectSingleNode("NAME").InnerText, nodeGateway.SelectSingleNode("CODE").InnerText))
            Next
      Catch er As XmlException
            Response.Write(er.ToString)
      Catch er As HttpException
            Response.Write(er.ToString)
      Catch er As Exception
            Response.Write(er.ToString)
      End Try
End Sub


End class
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now