The type or namespace name 'UserMaster' could not be found (are you missing a using directive or an assembly reference?)
I have a folder in my website called "masterpages" with a master page called "UserMaster". I keep getting this error when I try to use it as an object in my code: The type or namespace name 'UserMaster' could not be found (are you missing a using directive or an assembly reference?) It used to work, until i made a copy of it (Copy UserMaster.master) just for back up purposes and then I started getting 开发者_JAVA技巧this error. Its like my code cant find my master page anymore in the assembly.
Make sure the master page's class name in the code behind matches the class name specified in the markup of the master page. Also make sure the copied version of the page, in its code behind doesn't use the same class name.
Well, it's difficult to say for sure without any code. If you're not already, you can use the @ MasterType directive:
<%@ MasterType virtualpath="~/Masters/UserMaster.master" %>
That should solve any reference issues.
精彩评论