Last post Sep 01, 2010 08:39 PM by Programor
Jul 14, 2010 11:36 AM|nitcoolish|LINK
i donot have any intentions till now of uploading my web project and just started working on MS VS9.0
I made a simple Linq based project (CODE BEHIND used)
AS i compiled it i got
Parser Error: Could not load type '_Default'.
I figured out 2 solutions for this(WHICH I CUDNT FIND IN MANY FORUMS). But nt sure...why doing them solves the problem.
The easy way out is to uncheck "place the code in the seperate file" while adding an item.
and then adding the statement <%@ Import Namespace="System.Linq" %> on top of ur aspx as in:
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Linq" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
If we deal whith the CODE behind technique....and have already used "USING System.Linq; in the definition,
I found a funny solution to the problem.
In ur default page...the top line is
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="<namespace>.<class>" %>
Now if i change the keyword from CodeBehind to CodeFile as in:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="<namespace>.<class>" %>
voila the error is gone!!! btw if u add a new webform now...it will automatically display the keyword CodeFile.
Please clear my concepts :)
Ps: hope it helps a few newbies lyk me :P
Could not load type .'_Default'
Aug 31, 2010 01:23 PM|AmruthaRaghavan|LINK
Specifies the name of the compiled file that contains the class associated with the page. This attribute is not used at run time.
Specifies a path to the referenced code-behind file for the page. This attribute is used together with the Inherits attribute to associate a code-behind source file with a Web page. The attribute is valid only for compiled pages.
Sep 01, 2010 08:39 PM|Programor|LINK
99% of the time this has to do with a bad reference, look at your paths carefully.
If you are loading the page's class from a dll then you don't need the CodeFile attribute or CodeBehind. Just set the inherits attribute.