Why are server elements underlined when placed inside content tags?

I have a web content form containing Div elements and various server-side controls such as DropDownList . When I run the application, it works without errors, but when I look at the HTML source, the server controls are red. When you hover over, say DropDownList tooltip warning is displayed:

 DropDownList is not a known element. This can occur if there is a compilation error in a website. 

Edited

 <%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="contentReportSchemesMenu.aspx.cs" Inherits="contentReportMenu" Title="Reports Menu" %> <asp:Content ID="ContentReportMenu" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <div id="divMenu" class="divMenu" runat="server"> <table id="tblMenuLayout" class="Options" runat="server"> <tr> <td colspan="2" class="Top">Scheme Reports Menu</td> <td></td> </tr> <tr> <td class="Left">Report Type</td> <td class="Right"> &nbsp;<asp:DropDownList ID="ddlReportType" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlReportType_SelectedIndexChanged"></asp:DropDownList> </td> </tr> <tr> <td class="Left">Select District</td> <td class="Right"> &nbsp;<asp:DropDownList ID="ddlDistrict" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlDistrict_SelectedIndexChanged" Enabled="False"></asp:DropDownList> </td> </tr> <tr> <td class="Left">Select Block</td> <td class="Right"> &nbsp;<asp:DropDownList ID="ddlBlock" runat="server" AutoPostBack="true" Enabled="False" OnSelectedIndexChanged="ddlBlock_SelectedIndexChanged"></asp:DropDownList> </td> </tr> <tr> <td colspan="2" style="text-align:center"> <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" Enabled="False" /> &nbsp;</td> <td></td> </tr> </table> </div> </asp:Content> 
+4
source share
4 answers

A quick Google search soon found a solution: delete the files from the folder "C: \ Documents and Settings [Username] \ Application Data \ Microsoft \ VisualStudio \ 9.0 \ ReflectedSchemas" (or "... \ VisualStudio \ 8.0 \ ..." if executed Visual Studio 2005) on Windows XP. On Windows 7, it is under "C: \ Users {User Profile] \ AppData \ Roaming \ Microsoft ... etc.". Remember that part of the "VisualStudio" path will differ depending on the installed version.

I closed Visual Studio (always good ideas for changes that would affect the IDE), deleted the files, and then reopened the project. The warnings have disappeared.

I found links to this solution at: http://forums.asp.net/t/1205528.aspx http://blogs.msdn.com/mikhailarkhipov/archive/2005/04/21/410557.aspx

FYI, the search term I used on Google, was "item not supported."

I do not know why this is happening, but I know that there are some elegant domain profiles in the network environment.

+4
source

You get this error because table running on the server, but the tr and td elements are not. When you specify runat="server" in a table element, it expects that the child elements will also be executed on the server.

There are two easy ways to check this:

  • Remove runat="server" from the table declaration;
  • Take a DropDownList outside the table

Try using one of these two options and see if it fixes the problem.

EDIT

Ensure that the ContentPlaceHolderID in the content form matches the identifier of the corresponding content area on the main page. If this does not fix your problem, try creating a new content form using the advice above and add the control to the form in the content area. If there are no errors, then you know that the problem is somewhere in your markup.

+3
source

Try removing the schema cache. To do this, close Visual Studio and delete all the files in the following directory:

C: \ Users \ USERNAME \ AppData \ Roaming \ Microsoft \ VisualStudio \ 10.0 \ ReflectedSchemas

After deleting the files, open Visual Studio again and the problem should be fixed.

+1
source

You said that "when I view the HTML source, the Server controls are red underlined" , but the HTML source cannot contain elements such as DropDownList because it is an ASP.NET control that is created as HTML Select a tag . Given that the general solution with clearing the circuit did not help you, maybe the problem is in another place ... I will try to assume that you open the ASPX / ASCX file itself using some third-party editor that ASP.NET does not know am I right?

0
source

All Articles