views:

2944

answers:

5

Ok, so, my visual studio is broken. I say this NOT prematurely, as it was my first response to see where I had messed up in my code. When I add controls to the page I can't reference all of them in the code behind. Some of them I can, it seems that the first few I put on a page work, then it just stops.

I first thought it may be the type of control as initially I was trying to reference a repeater inside an update panel. I know I am correctly referencing the code behind in my aspx page. But just in case it was a screw up on my part I started to recreate the page from scratch and this time got a few more controls down before VS stopped recognizing my controls.

After creating my page twice and getting stuck I thought maybe it was still the type of controls. I created a new page and just threw some labels on it. No dice, build fails when referencing the control from the code behind.

In a possibly unrelated note when I switch to the dreaded "design" mode of the aspx pages VS 2008 errors out and restarts.

I have already put a trouble ticket in to Microsoft. I uninstalled all add-ins, I reinstalled visual studio.

Anyone that wants to see my code just ask, but I am using the straight WYSIWYG visual studio "new aspx page" nothing fancy.

I doubt anyone has run into this, but have you?

Has anyone had success trouble shooting these things with Microsoft? Any way to expedite this ticket without paying??? I have been talking to a rep from Microsoft for days with no luck yet and I am dead in the water.

Thank you.


Jon Limjap: I edited the title to both make it clear and descriptive and make sure that nobody sees it as offensive. "Foo-barred" doesn't exactly constitute a proper question title, although your question is clearly a valid one.

+4  A: 

Is the control that you are trying to reference inside of the repeater?

If so then you need to look them up using the FindControl method.

For example for:

<asp:Repeater ID="Repeater1" runat="server">
    <ItemTemplate>
        <asp:LinkButton ID="LinkButton1" runat="server">stest</asp:LinkButton>
    </ItemTemplate>
</asp:Repeater>

You would need to do this to reference it:

LinkButton lb = Repeater1.FindControl("LinkButton1");
Sean Lynch
+7  A: 

try clearing your local VS cache. find your project and delete the folder. the folder is created by VS for what reason I honestly don't understand. but I've had several occasions where clearing it and doing a re-build fixes things... hope this is all that you need as well.

here C:\Documents and Settings\Administrator\Local Settings\Temp\VWDWebCache

and possibly

here C:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft\WebsiteCache

Brian Boatright
Do you know where this cache is in Vista?
Brian G
sorry I don't. I installed Vista once and then went back to XP. Try doing a just a folder search for VWDWebCache or WebsiteCache and see if you can find it. If so please add another comment or an answer.
Brian Boatright
+1  A: 

you will also find .net temp files which are safe to delete here: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files

+2  A: 

The above fix (deleting the temp files) did not work for me. I had to delete the PageName.aspx.designer.cs file, then right-click my page, and choose "Convert to Web Application" from the context menu.

When Visual Studio attempted to rebuild the designer file, it encountered (and revealed to me) the source of the problem. In my case, VS had lost a reference to a DLL needed by one of the controls on my page, so I had to clean out the generated bin folders in my project.

LorettoDave
+1. Everytime I run into an issue like this it always boils down to a problem in the auto generated designer file. Performing these steps brings the error to light.
Chris Lively
A: 

In my case, I was working with some old web site code, which I converted to a VS2008 solution. I encountered this same problem.

For me, the fix was to right-click the Web Sites project in the Solution Explorer and select Convert to Web Application. This created designer.cs files for all pages, which did not yet have these files before.

Daan