?
Solved

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

Posted on 2006-11-06
19
Medium Priority
?
568 Views
Last Modified: 2008-01-09
Hi

Im recieving the error on line below:

ddlGateway.Items.Add(New ListItem(nodeGateway.SelectSingleNode("NAME").InnerText, nodeGateway.SelectSingleNode("CODE").InnerText))

which i think i already present in aspx file:

<form id="form1" method="post" runat="server">
<asp:DropDownList ID="ddlGateway" runat="server" AutoPostBack="true"></asp:DropDownList>
</form>


The error says;

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

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

Source Error:
Line 21:                 Dim nodeGateway As XmlNode
Line 22:                 For Each nodeGateway In nodeListGateway
Line 23:                     ddlGateway.Items.Add(New ListItem(nodeGateway.SelectSingleNode("NAME").InnerText, nodeGateway.SelectSingleNode("CODE").InnerText))
Line 24:                 Next
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
  • 7
  • 6
  • 5
  • +1
19 Comments
 
LVL 25

Expert Comment

by:DBAduck - Ben Miller
ID: 17886023
This should happen automatically, what is the IDE you are using to create this page?  Is your class definition using a Partial or just a class?

Is this 2.0 or 1.1 .NET Framework?

Ben.
0
 

Author Comment

by:shwaqar82
ID: 17886247
Im not sure if it is 1.1 or 1.0 but ya im not using 2.0 for sure. Well im not using any definition for class neither Partial nor Public
0
 
LVL 4

Expert Comment

by:darkpriest
ID: 17886363
Name 'ddlGateway' is not declared.


Check your actual control, go to the HTML and look at the ID, better yet post the entire html line thats referencing the drop down list.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 4

Expert Comment

by:darkpriest
ID: 17886366
oh freaking hell scratch that, hahaha

0
 
LVL 4

Expert Comment

by:darkpriest
ID: 17886371
To Rule out a control going funny, try and create a new control drop down list.

DO a simple thing like

dropdownlist2.items.add("random")

0
 

Author Comment

by:shwaqar82
ID: 17886378
y ur prefering dropdownlist2 instead
0
 
LVL 4

Expert Comment

by:darkpriest
ID: 17886599
Just used it as an example

Use anyname you like, create a default drop down.  And use that name.

0
 
LVL 25

Accepted Solution

by:
DBAduck - Ben Miller earned 2000 total points
ID: 17887118
So if you are using 1.1 and not using Visual Studio or Visual Web Developer Express, then you will need to make sure that the object exists in the Init() sub.

Sub Init()
Dim ddlGateway = new DropDownList()
End Sub

Because the Visual Studio by default adds this in (for 2003 not 2005 because of different compilation models) for you.  It puts it in a collapsed section of Init.

If you put an Init Sub in, or put the code above in your .vb file, the error will go away and everything should work as you want.

Ben.
0
 
LVL 4

Expert Comment

by:satish_nagdev
ID: 17887323
hi,

i know a trick might be helpful to you. first close .cs or .vb for corresponding to the form for which u r getting error.open form in html view, then at bottom of the form u'll see html view & designer view i think click on designer view & press F7. now you should see that your ddl is declared in code behind.

regards,
satish.
0
 

Author Comment

by:shwaqar82
ID: 17889105
dbaduck

well im using dreamweaver neither VS.Net nor VWD. I put the code as you mentioned me but no success. I think you are close to catch the error. Please help me out

0
 
LVL 25

Expert Comment

by:DBAduck - Ben Miller
ID: 17891901
Well, with Dreamweaver, you will have to know the server version of ASP.NET that you are using.  Because this is the one that will govern how you will want to proceed.  

ASP.NET 2.0 will create all the necessary New objects for you and compile it in with a Partial class thing, and 1.1 will not, and will expect all the objects to be in the aspx file or that the aspx refers to the .vb file.

So to completely help you out, I need to know what version of Framework you are targeting on the server.

Ben.
0
 

Author Comment

by:shwaqar82
ID: 17893417
its version 1.1
0
 
LVL 25

Expert Comment

by:DBAduck - Ben Miller
ID: 17893733
OK, I will get back to you on this later today and let you know what you need to have in your code.  But it would help if you sent your sample code to dbaduck at hotmail.com and I can make sure that you have all the right components in it and I will post the answer with the right stuff and explain how you can accomplish this with your Dreamweaver code.

Ben.
0
 

Author Comment

by:shwaqar82
ID: 17894896
aight thats kool that you give me a feed back.....unlike others they are not replaying if they working on it or not ...your feedback make me feel better ...n i feel like someone is still working with me. I wana add you on wshaukat at hotmail.com and we will go from there. I hope you dont mind.

Also i made the page working by adding the code in script tag of aspx file. But the purpose of using code behind technique is lost . As code behind shoud be in a separate file.
Still wana know how to put that code in a separate vb file.

Best Regards
Shaukat Waqar
shaukat@selloffvacations.com
0
 
LVL 4

Expert Comment

by:darkpriest
ID: 17903366
shwaqar82, its not that no one is replying sometimes it takes a view days, due to time differences and the fact that most people have a job in IT here, that would take up a chunk of time, most people do it in their spare time, which is sometimes very rare.

0
 

Author Comment

by:shwaqar82
ID: 17903392
darkpriest

i do understand that. but is that not a good idea to give a feedback as u did. i already added u in my list. if u dun mind can u juz come online.
0
 
LVL 25

Expert Comment

by:DBAduck - Ben Miller
ID: 17903535
shwaqar82,

Were you going to send me a code page that you are using in dreamweaver?  I saw you added yourself to my MSN Messenger, but I did not see an email come to my hotmail box that had the code files (aspx, aspx.vb) so that I could help you get them hooked up.

Ben.
0
 

Author Comment

by:shwaqar82
ID: 17903663
right now im in my office ...i can send you tomorrow when ever i will be in my office. i was in the impression to chat with you online so we can discuss several others issues as well as i wana utilize some of your expetise that helps me gaining the experiance. THANKS ALOT for being a dedicated person
0
 
LVL 25

Expert Comment

by:DBAduck - Ben Miller
ID: 17904434
I am happy to IM with you, but it would be very helpful to all the users of EE here, that would benefit from the answer that we produce.  And even for the IM conversation, I would need the code files to look at and resolve with you.

Thanks.
Ben.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

777 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