I created a visual webpart from VS2012. The headers of the ascx
page are
<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MyVisualWebPart.ascx.cs" Inherits="MySPSolution.WebParts.MyVisualWebPart.MyVisualWebPart" %>
later in the code i have
<asp:Label ID="Label1" runat="server" Text="<%$Resources:MyResources,Title%>" />
The problem is that when i use the <%$
there is a build error says
The name 'InitializeControl' does not exist in the current context
It's not that it doesn't find a key in MyResources
. It doesn't compile at all. By the way MyResources
is in App_GlobalResources
folder, and the same usage works in an aspx
page.
What i am doing wrong?
g.cs
file is empty. Can i fix it? – pbaris Apr 8 '13 at 9:18