Solved

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

Posted on 2006-11-06
19
563 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
  • 7
  • 6
  • 5
  • +1
19 Comments
 
LVL 24

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
 
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 24

Accepted Solution

by:
DBAduck - Ben Miller earned 500 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

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 24

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 24

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 24

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 24

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

758 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

22 Experts available now in Live!

Get 1:1 Help Now