Reputation: 5133
I'm developing with Visual Studio 2017 a WebForm Asp.Net web application.
it's a couple of days that the event handler autocomplete doesn't work anymore:
Previously, after I've added a control on the page, I was able to type the name of the event, OnClick in example, and then by typing the =" Visual studio shows me a drop down with the "create new..." and the list of the compatible handlers for the event.
The "create new..." feature is quite fundamental to me as I don't always know the signature of the method, and overall I don't have to write it by hand.
All these tasks were performed in the source view of the aspx page, and the event handler method was inserted automatically by Visual Studio in the aspx.cs file.
For example, on a button control, by selecting the "Create New..." item in the event handlers suggestions, VS automatically create the following code in aspx.cs:
protected void BtnDoSomething_Click(object sender, EventArgs e)
{
}
Now the drop-down suggestions are not shown anymore.
The project compiles successfully. I've tried to restart the project, restart VS, restart the PC, open an old project... nothing has worked.
What can I do to bring it back?
Upvotes: 3
Views: 2315
Reputation: 1
Check your
CodeBehind="yourwebpagename.aspx.cs"
at the top of the page.
Upvotes: 0
Reputation: 54
Well I'm running VS2017 15.5.6 and have the same problem with a Webforms application. My workaround is to temporary delete most of the code from markup (saving it in Notepad), leaving only the controls directly surrounding and including the control that needs the event handler itself, then add the event handler, which than succeeds, and add the removed code back again. Although there might be some hidden errors in my code, I’m unable to find them and there are no warnings or errors mentioned. But this particular page is rather large: 600 lines in markup and 1932 lines in code behind. Markup contains about 500 controls.
Edit: I've updated to version 15.7.3: the problem still exists
Upvotes: 1
Reputation: 5133
Also upgrading Visual Studio to 15.6.3 has not solved the issue. I've tried also the following:
None of the above has worked.
I've noticed that inside a new blank page in the same project the intellisense was working fine. After some debug I've found that the attribute "style" of some elements in the page was causing the issue:
<div style="display:none"></div>
By removing all the style attribs from the .aspx page solved the issue.
By adding back again also one of it cause the intellisense stop to work. It's not really an issue as I use style only for fast&quick test, so I'll avoid them, but Does anyone know why?!?
Upvotes: 1