Solved

BC30451 Error

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Insert multiple row form with checkboxes 9 1,030
Saving Form Data when Leaving Page 3 360
I want to center my image horizontally with CSS3 8 459
JQuery form validation for bootstrap 1 193
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 …
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

803 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