Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I solve the error 'System.Web.UI.MasterPage' does not contain a definition for
    text
    copied!<p>I have two master pages and a content page. On my local machine this code works, but once I uploaded to the server I got the following error:</p> <p>Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. </p> <p>Compiler Error Message: CS1061: 'System.Web.UI.MasterPage' does not contain a definition for 'DivWidth' and no extension method 'DivWidth' accepting a first argument of type 'System.Web.UI.MasterPage' could be found (are you missing a using directive or an assembly reference?)</p> <p>Source Error:</p> <p>Line 84:<br> Line 85:<br> Line 86: this.Master.Master.DivWidth = 955; Line 87: SimpleElementCollection restrictedIds = new SimpleElementCollection(); Line 88: restrictedIds.Add(new SimpleElement(priceModifierPriceTypeId));</p> <p>Source File: c:\Inetpub\testsite\shop\Default.aspx.cs Line: 86 </p> <p>Base Masterpage cocde:</p> <pre><code>public partial class global : System.Web.UI.MasterPage { public int DivWidth { get; set; } protected void Page_Load(object sender, EventArgs e) { SetBodyClass(); if (DivWidth &lt; 1) { DivWidth = 768; } } </code></pre> <p>Base Masterpage aspx:</p> <pre><code>&lt;%@ Master Language="C#" AutoEventWireup="true" CodeFile="global.master.cs" Inherits="global" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr"&gt; &lt;head id="Head1" runat="server" dir="ltr" lang="en-us" profile="http://dublincore.org/documents/dcq-html/"&gt; &lt;meta http-equiv="X-UA-Compatible" content="IE=7" /&gt; &lt;title&gt;page title&lt;/title&gt; &lt;meta http-equiv="content-type" content="text/html; charset=UTF-8" /&gt; &lt;meta http-equiv="content-type" content="en-US" /&gt; &lt;meta http-equiv="content-language" content="en-us" /&gt; &lt;link rel="Bookmark" href="#content" title="Page Content" type="text/html" /&gt; &lt;link rel="Bookmark" href="#primary-navigation" title="Site Navigation" type="text/html" /&gt; &lt;link href="css/screen/global.css" rel="stylesheet" type="text/css" media="screen" /&gt; &lt;link href="css/print/print.css" rel="stylesheet" type="text/css" media="print" /&gt; &lt;script src="&lt;%=ResolveUrl("~/javascript/jquery-1.2.6.min.js")%&gt;" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="&lt;%=ResolveUrl("~/javascript/jquery.clearonfocus.js")%&gt;" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="&lt;%=ResolveUrl("~/javascript/modalControl.js")%&gt;" type="text/javascript"&gt;&lt;/script&gt; &lt;asp:ContentPlaceHolder ID="headPlaceholder" runat="server" /&gt; &lt;!--[if IE]&gt;&lt;link href="css/screen/ie/ie.css" rel="stylesheet" type="text/css" media="screen" /&gt;&lt;![endif]--&gt; &lt;!--[if IE 6]&gt;&lt;link href="css/screen/ie/ie-6.css" rel="stylesheet" type="text/css" media="screen" /&gt;&lt;![endif]--&gt; ] &lt;/head&gt; &lt;body id="Body" runat="server"&gt; &lt;div id="main"&gt; &lt;div id="main-inner"&gt; &lt;div id="content" style="width:&lt;%=DivWidth%&gt;px;"&gt;&lt;div id="content-top"&gt;&lt;/div&gt;&lt;div class="content-inner"&gt;&lt;asp:ContentPlaceHolder ID="contentPlaceHolder" runat="server" /&gt;&lt;asp:ContentPlaceHolder ID="BelowLeftRightMainContent" runat="server" /&gt;&lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Second Master Page:</p> <pre><code>&lt;%@ Master Language="C#" MasterPageFile="~/global.master" AutoEventWireup="false" CodeFile="shopFalcon.master.cs" Inherits="shopFalcon" %&gt; &lt;%@ Register TagPrefix="FALCON" TagName="FeatureProducts" Src="~/FalconShopRightHand.ascx" %&gt; &lt;%@ Register TagPrefix="FALCON" TagName="ProductSearch" Src="~/FalconProductSearch.ascx" %&gt; &lt;%@ Register TagPrefix="FALCON" TagName="AbuseText" Src="~/FalconAbuseLinkDisplay.ascx" %&gt; &lt;asp:Content ID="Content1" ContentPlaceHolderID="headPlaceholder" Runat="Server"&gt; &lt;/asp:Content&gt; </code></pre> <p>nothing in the code behind cept empty code behind</p> <p>My content page:</p> <pre><code>&lt;%@ Page Language="C#" MasterPageFile="~/shop.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="shopFalcon_Default" Title="Shop Homepage" %&gt; &lt;%@ MasterType VirtualPath="~/shop.master"%&gt; &lt;asp:Content ID="Content7" ContentPlaceHolderID="leftColPlaceHolder" Runat="Server"&gt; &lt;asp:Image ID="Image1" runat="server" ImageAlign="Right" ImageUrl="~/images/Free+Shipping+01.jpg" CssClass="img"/&gt; &lt;h1&gt;Shop Anytime, anywhere. &lt;/h1&gt; &lt;div id="shopByBrandDiv"&gt; &lt;/asp:Content&gt; </code></pre> <p>My code behind:</p> <pre><code> protected void Page_Load(object sender, EventArgs e) { this.Master.Master.DivWidth = 955; } </code></pre> <p>Again this works in Visual Studio using the built in web server but delpoying to the production server running IIS6 I get that error stated above.</p> <p>Any ideas?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload