Link to home
Start Free TrialLog in
Avatar of bozworthy
bozworthyFlag for United States of America

asked on

New ASP control not accessible in code behind

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?
ASKER CERTIFIED SOLUTION
Avatar of stengelj
stengelj
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
Avatar of DreamMaster
DreamMaster

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

ASKER

The wireup trick worked.  That's a reasonable workaround as opposed to closing/opening the entire folder.
Actually, just inserting or deleting a blank line in the aspx page works too.
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!