Link to home
Start Free TrialLog in
Avatar of shwaqar82
shwaqar82

asked on

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
Avatar of DBAduck - Ben Miller
DBAduck - Ben Miller
Flag of United States of America image

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.
Avatar of shwaqar82
shwaqar82

ASKER

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
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.
oh freaking hell scratch that, hahaha

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")

y ur prefering dropdownlist2 instead
Just used it as an example

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

ASKER CERTIFIED SOLUTION
Avatar of DBAduck - Ben Miller
DBAduck - Ben Miller
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
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

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.
its version 1.1
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.
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
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.

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