Question

I have an ASPX Page:

<%@ Page Language="C#" MasterPageFile="~/site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="myProject.Presentation.Web.Default" src="Default.aspx.cs" %>
<%@ MasterType VirtualPath="~/site.Master" %>

...

<asp:Repeater ID="rGrid" runat="server">
 <ItemTemplate>
  ...
 </ItemTemplate>
</asp:Repeater>

With this Master:

<%@ Master Language="C#" AutoEventWireup="true" Codebehind="site.master.cs" Inherits="myProject.Presentation.Web.master" src="~/site.Master.cs" %>

When I try to access one of the members on the page:

namespace myProject.Presentation.Web {
public partial class Default : System.Web.UI.Page
     ...
     rGrid.DataSource = myProject.Business.User.GetReports(UserId, true);

I get this YSOD on that line:

CS0103: The name 'rGrid' does not exist in the current context

Yet Intellisense and Object Exporer say it's valid. Why is that?

Was it helpful?

Solution

Is this a website or web app?

If it's a web app, delete your designer files, then right click on your aspx page and/or master page and select convert to web app. This will rebuild the designer files.

OTHER TIPS

This is nonsense, canned the project and redoing it as a website project.

This error generally occurs when variable declerations and variable usage are in different scopes. Check *.aspx.cs file and designer file namespace , namespaces must be same..

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top