Intellisense does not recognize Sharepoint.WebControl elements in control template

I am working with a project generated by Sharepoint VS2008 Template (VSeWSS). Currently, while working in ASCX files that I have, IntelliSense does not recognize imported namespaces. I'm not sure what to do to fix this issue.

Note. The edit below SharePoint.WebPartPages

works fine, but just SharePoint.WebControls

that doesn't.

The project runs without errors and deploys correctly. Deleting a row <%@Register Tagprefix="SharePoint"...

results in the expected error "Unknown server tag" SharePoint: SPGridView "after deployment.

I found similar questions (like Unrecognized Tags Preprint or Device Filter in Visual Studio 2008 ), however, the question and its answers are specific to web projects only. In particular, they talk about a file web.config

. Something that is not created as part of a SharePoint template.

Suggested solutions and reasons why they didn't work:

  • Create web.config file - File does not exist in this project
  • Add link to dll - no visible effect

Further guidance or suggestions to fix this are appreciated.

<%@ Control Language="C#" AutoEventWireup="true"
   Inherits="HelloWorld1.UserTableDoom, HelloWorld1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=2ace7ea1e94310d3" %>
<%@ Register Tagprefix="SharePoint" 
   Namespace="Microsoft.SharePoint.WebControls"
   Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<SharePoint:SPGridView ID='fooGrid' runat='server'
   AutoGenerateColumns='false'
   DataKeyNames='user_id'
   DataSourceID='foo'>
...
</SharePoint:SPGridView>

      

Edit: Interesting that I can add a namespace WebPartPages

and I have it working correctly in IntelliSense.

I also noted that when creating a completely new solution and placing the ASCX file in it. The problem still exists. SharePoint.WebPartPages works, but SharePoint.WebControls doesn't.

<%@ Register Tagprefix="WebPartPages"
   Namespace="Microsoft.SharePoint.WebPartPages"
   Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<WebPartPages:...>  -- works correctly.

      

+2


source to share


4 answers


I am using the same code you should display SPGridView but has no Intellisense issues. It puts weird formatting above the word SharePoint

in Microsoft.SharePoint.WebControls

, but it works great from that:

<%@ Control Language="C#" AutoEventWireup="true" Inherits="QueryDemo.QueryDemoControl, QueryDemo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5434e690be8749f6" %>
<%@ Register Tagprefix="WebControls" Namespace="System.Web.UI.WebControls" Assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<SharePoint:SPGridView
    id="queryGrid"
    runat="server"
    DataSourceId="queryData"
    AutoGenerateColumns="false"
    width="100%"
    AllowSorting="True">
      <AlternatingRowStyle CssClass="ms-alternating"/>
</SharePoint:SPGridView>

      



Make sure you have a link to Microsoft.SharePoint in your Visual Studio project and try the code. If the grid is showing, then the problem should lie with Intellisense.

+1


source


Try installing Visual Studio Service Packs.



0


source


Try the following:

C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv -resetsettings

      

You may need to run as admin for maximum effect.

0


source


I also do the assembly with my own line and it works:

<%@ Assembly Name="Microsoft.SharePoint, Version......" %>

      

....... the rest of the line.

0


source







All Articles