Solved

BC30451 Error

Posted on 2006-11-07
1
419 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

734 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