Solved

BC30451 Error

Posted on 2006-11-07
1
417 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Title # Comments Views Activity
slide show not working correctly 10 420
Webpage Not Working in IE 27 360
multiple selection list and png image 5 368
Debug PHP with Dreamweaver 6 846
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…
This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

809 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