[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 570
  • Last Modified:

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

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
shwaqar82
Asked:
shwaqar82
  • 7
  • 6
  • 5
  • +1
1 Solution
 
DBAduck - Ben MillerPrincipal ConsultantCommented:
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
 
shwaqar82Author Commented:
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
 
darkpriestCommented:
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
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!

 
darkpriestCommented:
oh freaking hell scratch that, hahaha

0
 
darkpriestCommented:
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
 
shwaqar82Author Commented:
y ur prefering dropdownlist2 instead
0
 
darkpriestCommented:
Just used it as an example

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

0
 
DBAduck - Ben MillerPrincipal ConsultantCommented:
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
 
satish_nagdevCommented:
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
 
shwaqar82Author Commented:
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
 
DBAduck - Ben MillerPrincipal ConsultantCommented:
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
 
shwaqar82Author Commented:
its version 1.1
0
 
DBAduck - Ben MillerPrincipal ConsultantCommented:
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
 
shwaqar82Author Commented:
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
 
darkpriestCommented:
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
 
shwaqar82Author Commented:
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
 
DBAduck - Ben MillerPrincipal ConsultantCommented:
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
 
shwaqar82Author Commented:
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
 
DBAduck - Ben MillerPrincipal ConsultantCommented:
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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 7
  • 6
  • 5
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now