Web Server controls not showing up on web page

M

Mark C

I have been playing with Visual Studio and trying to learn it. I am creating a simple web application with a web form named WebForm1.aspx (using defaults). I placed Label and Button from the Web Forms section of the toolbox. I double clicked the button to get the code behind event for the button onclick event. I assign the value of "Hello World" (real basic stuff) to the label text property. After building and browsing all I see is the Label. The button does not display. If I add an HTML button it displays, but I can't add any code to it. I am running on XP Pro, Visual Studio Enterprise Edition. I am attaching my code below, but I can't figure out why this doesn't work. (I took it from a training manual that is step by step.) IIS is running on my machine as far as I can tell

Thanks in advance for any clarification

// Cod
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 MyFirstWebApplicationC

/// <summary
/// Summary description for WebForm1
/// </summary
public class WebForm1 : System.Web.UI.Pag

protected System.Web.UI.WebControls.Label lblMessage
protected System.Web.UI.WebControls.Button Button1

private void Page_Load(object sender, System.EventArgs e

// Put user code to initialize the page her


#region Web Form Designer generated cod
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 modif
/// the contents of this method with the code editor
/// </summary
private void InitializeComponent(
{
this.Button1.Click += new System.EventHandler(this.Button1_Click)
this.Load += new System.EventHandler(this.Page_Load)


#endregio

private void Button1_Click(object sender, System.EventArgs e

lblMessage.Text = "Hello World!"
 
V

Victor Garcia Aprea [MVP]

Hi Mark,

It sounds like ASP.NET is not properly registered, please take a look at the
aspnet_regiis.exe console application to re-register ASP.NET and see if that
helps.

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx
To contact me remove 'NOSPAM'. Please post all questions to the newsgroup

Mark C said:
I have been playing with Visual Studio and trying to learn it. I am
creating a simple web application with a web form named WebForm1.aspx (using
defaults). I placed Label and Button from the Web Forms section of the
toolbox. I double clicked the button to get the code behind event for the
button onclick event. I assign the value of "Hello World" (real basic
stuff) to the label text property. After building and browsing all I see is
the Label. The button does not display. If I add an HTML button it
displays, but I can't add any code to it. I am running on XP Pro, Visual
Studio Enterprise Edition. I am attaching my code below, but I can't figure
out why this doesn't work. (I took it from a training manual that is step
by step.) IIS is running on my machine as far as I can tell.
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top