JIT Cmpile Error CS0234


G

Guest

I was getting the following error after compiling the C# source file with
VS.NET 2003, Any help will be appreciated.

Many thanks!
Surjeet Gill

Details:

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.

Compiler Error Message: CS0234: The type or namespace name 'Global' does not
exist in the class or namespace 'System.Web.UI.WebControls.PlaceHolder' (are
you missing an assembly reference?)

Source Error:
Line 26:
Line 27: [System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()]
Line 28: public class Global_asax : PlaceHolder.Global {
Line 29:
Line 30: private static bool __initialized = false;


Source File: c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET
Files\chapter02_placeholder\3f5aa4a9\6f93a474\mzryuqmu.0.cs Line: 28

This was the only C# source file in the project.
// File Placeholder.aspx.cs
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;


namespace PlaceHolder
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.TextBox txtName;
protected System.Web.UI.WebControls.DropDownList ddlDays;
protected System.Web.UI.WebControls.Panel pnlDynamic;

// Use the Page_Load event to load the dynamically created
// controls so that they are available prior to rendering
private void Page_Load(object sender, System.EventArgs e)
{
// Get the value selected by user in the dropdown list
int intDays = Convert.ToInt32(ddlDays.SelectedItem.Value);
// Create textboxes to allow entering the
// travel expenses for each travel day
for (int i = 1; i <= intDays; i++)
{
LiteralControl lcExpenseCaption = new LiteralControl();
lcExpenseCaption.Text =
String.Format("Travel Expense for Day-{0} ", i);
// Create a textbox control
TextBox txtExpense = new TextBox();
// Set the ID property of the textbox
txtExpense.ID = String.Format("Expense{0}", i);
HtmlControl lcBreak = new HtmlGenericControl("br");
pnlDynamic.Controls.Add(lcExpenseCaption);
// Add the textbox to the panel
// if you omit this step, textbox is
// created but not displayed
pnlDynamic.Controls.Add(txtExpense);
pnlDynamic.Controls.Add(lcBreak);
}
// Display a linkbutton that allow users to
// post the expenses after they have entered the data
if(intDays>0)
{
LinkButton lbtnSubmit = new LinkButton();
lbtnSubmit.Text = "Submit Expenses";
// Add an event handler to the dynamically created
// link button
lbtnSubmit.Click += new EventHandler(lbtnSubmit_Click);
pnlDynamic.Controls.Add(lbtnSubmit);
HtmlControl lcBreak = new HtmlGenericControl("br");
pnlDynamic.Controls.Add(lcBreak);
}
}
// Handles the Click event for the dynamically
// created link button
private void lbtnSubmit_Click(object sender, System.EventArgs e)
{
double dblExpenses = 0;
int intDays = Convert.ToInt32(ddlDays.SelectedItem.Value);
// Find sum of all expenses
for (int i = 1; i <= intDays; i++)
{
// Find control in the collection of controls
// contained by the panel
TextBox txtExpense = (TextBox)
pnlDynamic.FindControl(String.Format("Expense{0}", i));
dblExpenses += Convert.ToDouble(txtExpense.Text);
}
// Display the results
Label lblResults = new Label();
lblResults.Text = String.Format(
"{0}, a sum of ${1} has been credited to your account",
txtName.Text, dblExpenses);
pnlDynamic.Controls.Add(lblResults);
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion
}
}
 
Ad

Advertisements

J

Jim Cheshire [MSFT]

Hi Surjeet,

Can you send me your machine.config file?

Jim Cheshire [MSFT]
MCP+I, MCSE, MCSD, MCDBA
Microsoft Developer Support
(e-mail address removed)

This post is provided "AS-IS" with no warranties and confers no rights.


--------------------
Thread-Topic: JIT Cmpile Error CS0234
thread-index: AcR7IRHxNMBu7KvDRL22qIZUPSr/Cg==
X-WBNR-Posting-Host: 198.91.4.14
From: =?Utf-8?B?U3VyamVldCBHaWxs?= <[email protected]>
Subject: JIT Cmpile Error CS0234
Date: Thu, 5 Aug 2004 12:19:03 -0700
Lines: 142
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:252413
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

I was getting the following error after compiling the C# source file with
VS.NET 2003, Any help will be appreciated.

Many thanks!
Surjeet Gill

Details:

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.

Compiler Error Message: CS0234: The type or namespace name 'Global' does not
exist in the class or namespace 'System.Web.UI.WebControls.PlaceHolder' (are
you missing an assembly reference?)

Source Error:
Line 26:
Line 27: [System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()]
Line 28: public class Global_asax : PlaceHolder.Global {
Line 29:
Line 30: private static bool __initialized = false;


Source File: c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET
Files\chapter02_placeholder\3f5aa4a9\6f93a474\mzryuqmu.0.cs Line: 28

This was the only C# source file in the project.
// File Placeholder.aspx.cs
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;


namespace PlaceHolder
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.TextBox txtName;
protected System.Web.UI.WebControls.DropDownList ddlDays;
protected System.Web.UI.WebControls.Panel pnlDynamic;

// Use the Page_Load event to load the dynamically created
// controls so that they are available prior to rendering
private void Page_Load(object sender, System.EventArgs e)
{
// Get the value selected by user in the dropdown list
int intDays = Convert.ToInt32(ddlDays.SelectedItem.Value);
// Create textboxes to allow entering the
// travel expenses for each travel day
for (int i = 1; i <= intDays; i++)
{
LiteralControl lcExpenseCaption = new LiteralControl();
lcExpenseCaption.Text =
String.Format("Travel Expense for Day-{0} ", i);
// Create a textbox control
TextBox txtExpense = new TextBox();
// Set the ID property of the textbox
txtExpense.ID = String.Format("Expense{0}", i);
HtmlControl lcBreak = new HtmlGenericControl("br");
pnlDynamic.Controls.Add(lcExpenseCaption);
// Add the textbox to the panel
// if you omit this step, textbox is
// created but not displayed
pnlDynamic.Controls.Add(txtExpense);
pnlDynamic.Controls.Add(lcBreak);
}
// Display a linkbutton that allow users to
// post the expenses after they have entered the data
if(intDays>0)
{
LinkButton lbtnSubmit = new LinkButton();
lbtnSubmit.Text = "Submit Expenses";
// Add an event handler to the dynamically created
// link button
lbtnSubmit.Click += new EventHandler(lbtnSubmit_Click);
pnlDynamic.Controls.Add(lbtnSubmit);
HtmlControl lcBreak = new HtmlGenericControl("br");
pnlDynamic.Controls.Add(lcBreak);
}
}
// Handles the Click event for the dynamically
// created link button
private void lbtnSubmit_Click(object sender, System.EventArgs e)
{
double dblExpenses = 0;
int intDays = Convert.ToInt32(ddlDays.SelectedItem.Value);
// Find sum of all expenses
for (int i = 1; i <= intDays; i++)
{
// Find control in the collection of controls
// contained by the panel
TextBox txtExpense = (TextBox)
pnlDynamic.FindControl(String.Format("Expense{0}", i));
dblExpenses += Convert.ToDouble(txtExpense.Text);
}
// Display the results
Label lblResults = new Label();
lblResults.Text = String.Format(
"{0}, a sum of ${1} has been credited to your account",
txtName.Text, dblExpenses);
pnlDynamic.Controls.Add(lblResults);
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top