Context is not a member of in asp.net usercontrol

real_yggdrasil picture real_yggdrasil · Oct 9, 2012 · Viewed 11.8k times · Source

I just created new usercontrol in an asp.net webapplication project.

Right after creation, the source looks like this:

<%@ Control Language="VB" AutoEventWireup="false" CodeFile="SSR_Project.ascx.vb" Inherits="CS_SSR_RAIO.SSR_Project" %>

But as soon as i add some additional code to it, the error on the first line is immedeately:

Context is not a member of 'CS_SSR_RAIO.SSR_Project

I do have other usercontrols who appear to have the exact same declarations, but dont have this error.

Any help would be greatly appreciated!

Answer

Ian Grainger picture Ian Grainger · Dec 4, 2015

I got this error because it couldn't find the class of my new usercontrol's codebehind. I had this because I'd copied a usercontrol and it was in a Namespace which I'd not added to the Inherits attribute correctly.

Added the namespace prefix and it started working again :)