Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

New ASP control not accessible in code behind

Posted on 2006-11-29
5
Medium Priority
?
378 Views
Last Modified: 2012-06-27
Sometimes when I add a new control in ASP it isn't accessible in the codebehind until I completely exit the website and reopen it in Visual Studio 2005.

Here's the latest one:
<asp:ListBox ID="lbStatus" Height="85px" Width="410px" AutoPostBack="false" CausesValidation="false" runat="server" Visible="true"></asp:ListBox>    

It is not available in the list of objects in codebehind.  And when I do "Me.lbStatus" it says it's not a member of my form.

I saved, did a Refresh from the Solution explorer, did a right-click -> refresh on the project name. Nothing works.  What's up with this?
0
Comment
Question by:bozworthy
[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
  • 2
  • 2
5 Comments
 
LVL 9

Accepted Solution

by:
stengelj earned 200 total points
ID: 18042660
I run into the same thing from time to time. I think this is some kind of funkiness in the Intellisence.  Here's what I do as a workaround when this happens to me, but I'd love to know if there is a better way.

1. In the .aspx page, set AutoEventWireup="true".
2. Click on a line below the page directed.  Anywhere will do.  It will trigger a refresh of the intellisence.
3. Go to your codebehind page and see if the control is now recognized.
4. If it is, reset the AutoEventWireup setting.
0
 
LVL 19

Expert Comment

by:DreamMaster
ID: 18043607
It can sometimes take a while for the Intellisence to recognize a control, but it should not happen to you all the time. I've had it on some occasions, but usually all I needed to do was go on typing and it would recognize it eventually.

Regards,
Max.
0
 
LVL 1

Author Comment

by:bozworthy
ID: 18045327
The wireup trick worked.  That's a reasonable workaround as opposed to closing/opening the entire folder.
0
 
LVL 1

Author Comment

by:bozworthy
ID: 18054870
Actually, just inserting or deleting a blank line in the aspx page works too.
0
 
LVL 9

Expert Comment

by:stengelj
ID: 18055130
Interesting...I guess if I just make it a habit to return after creating a control, this should happen anymore.

Thanks for the shorter workaround!
0

Featured Post

Technology Partners: 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

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…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

721 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