Solved

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

Posted on 2006-11-06
19
565 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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
 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

825 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