Click here to Skip to main content
15,899,475 members
Home / Discussions / C#
   

C#

 
GeneralRe: ILDASM and Memory. Some confusion... Pin
Alex Korchemniy10-Dec-04 8:41
Alex Korchemniy10-Dec-04 8:41 
GeneralRe: ILDASM and Memory. Some confusion... Pin
Heath Stewart10-Dec-04 12:46
protectorHeath Stewart10-Dec-04 12:46 
GeneralRe: ILDASM and Memory. Some confusion... Pin
Alex Korchemniy10-Dec-04 13:28
Alex Korchemniy10-Dec-04 13:28 
GeneralRe: ILDASM and Memory. Some confusion... Pin
Judah Gabriel Himango10-Dec-04 12:05
sponsorJudah Gabriel Himango10-Dec-04 12:05 
GeneralWindows Forms Transition Pin
mrlou8810-Dec-04 5:16
mrlou8810-Dec-04 5:16 
GeneralRe: Windows Forms Transition Pin
Dave Kreskowiak10-Dec-04 6:06
mveDave Kreskowiak10-Dec-04 6:06 
GeneralRe: Windows Forms Transition Pin
mrlou8810-Dec-04 6:23
mrlou8810-Dec-04 6:23 
GeneralCompiler Error message Pin
cmitty10-Dec-04 4:31
cmitty10-Dec-04 4:31 
I am learning C# web development with Visual studio .NET and I cannot get past this error. Whilst working from a book i got the following error.

"A namespace does not directly contain members such as fields or methods."

I have included the code belowwhich was typed out of the book. It throws the error to line 75(near bottom). I have highlighted it. It is not happy with override protected void OnInit(EventArgs e. Namely override has red line in the API. I did not even type this part of the code in as it was webgenerated code. If anyone could point me in the direction I would be so Grateful as ths is for my Final year project at university.

Many thanksCry | :((

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
//I removed using System.Drawing from here
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace FriendsReunion
{

public class _Default : System.Web.UI.Page
{
protected System.Web.UI.WebControls.PlaceHolder phNav;
protected FriendsReunion.SubHeader ccSubHeader;

private void Page_Load(object sender, System.EventArgs e)
{
Table tb = new Table();
TableRow row;
TableCell cell;
Image img;
Hyperlink lnk;

if (Context.User.Identity.IsAuthenticated)
{
//Create a new blank table row
row = new TableRow();

//Set up the News image
img = new Image();
img.ImageUrl = "Images/globe.gif";
img.ImageAlign = ImageAlign.Middle;
img.Width = new Unit(24, UnitType.Pixel);
img.Height = new Unit(24,UnitType.Pixel);

//Create a cell and add the image
cell = new TableCell();
cell.Controls.Add(img);

//Add the new cell to the row
row.Cells.Add(cell);

//Set up the News link
lnk = new HyperLink();
lnk.Text = "News";
lnk.NavigateUrl = "News.aspx";

//Create the cell and the add link
cell = new TableCell();
cell.Controls.Add(lnk);

//Add the new cell to the row
row.Cells.Add(cell);

//Add the row to the table
tb.Rows.Add(row);
}
else
{
//code for authenticated users here...
}

//Finally, add the table to the placeholder
phNav.Controls.Add(tb);
}
}

}

#region Web Form Designer generated code
LINE 75 >>> 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





GeneralRe: Compiler Error message Pin
J4amieC10-Dec-04 4:37
J4amieC10-Dec-04 4:37 
GeneralRe: Compiler Error message Pin
Daniel Turini10-Dec-04 4:40
Daniel Turini10-Dec-04 4:40 
GeneralRe: Compiler Error message Pin
cmitty10-Dec-04 5:41
cmitty10-Dec-04 5:41 
GeneralUgly dynamic resizing of a control Pin
G.Ringbom10-Dec-04 2:56
G.Ringbom10-Dec-04 2:56 
GeneralRe: Ugly dynamic resizing of a control Pin
Alexander Kent10-Dec-04 17:21
Alexander Kent10-Dec-04 17:21 
GeneralRe: Ugly dynamic resizing of a control Pin
G.Ringbom10-Dec-04 21:44
G.Ringbom10-Dec-04 21:44 
GeneralRe: Ugly dynamic resizing of a control Pin
Alexander Kent10-Dec-04 22:08
Alexander Kent10-Dec-04 22:08 
Generalrubber banding Pin
Sam198210-Dec-04 1:44
Sam198210-Dec-04 1:44 
GeneralRe: rubber banding Pin
Alexander Kent10-Dec-04 17:04
Alexander Kent10-Dec-04 17:04 
GeneralRaising &quot;Dll loading failed&quot; exception Pin
Anonymous10-Dec-04 0:28
Anonymous10-Dec-04 0:28 
GeneralRe: Raising &quot;Dll loading failed&quot; exception Pin
Daniel Turini10-Dec-04 0:32
Daniel Turini10-Dec-04 0:32 
Generalhelp request on......! Pin
5059-Dec-04 23:41
5059-Dec-04 23:41 
GeneralRe: help request on......! Pin
Stefan Troschuetz10-Dec-04 0:15
Stefan Troschuetz10-Dec-04 0:15 
GeneralRe: help request on......! Pin
Daniel Turini10-Dec-04 0:29
Daniel Turini10-Dec-04 0:29 
GeneralRe: help request on......! Pin
DavidNohejl10-Dec-04 1:32
DavidNohejl10-Dec-04 1:32 
GeneralRe: help request on......! Pin
Dave Kreskowiak10-Dec-04 5:53
mveDave Kreskowiak10-Dec-04 5:53 
Generalhelp req: showing gray scale image Pin
arus20049-Dec-04 23:33
arus20049-Dec-04 23:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.