Web Server controls not showing up on web page

Discussion in 'ASP .Net Building Controls' started by Mark C, Jan 29, 2004.

  1. Mark C

    Mark C Guest

    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!"
     
    Mark C, Jan 29, 2004
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:...
    > 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.
    >
    > // Code
    > 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 MyFirstWebApplicationCS
    > {
    > /// <summary>
    > /// Summary description for WebForm1.
    > /// </summary>
    > public class WebForm1 : System.Web.UI.Page
    > {
    > 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 here
    > }
    >
    > #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.Button1.Click += new System.EventHandler(this.Button1_Click);
    > this.Load += new System.EventHandler(this.Page_Load);
    >
    > }
    > #endregion
    >
    > private void Button1_Click(object sender, System.EventArgs e)
    > {
    > lblMessage.Text = "Hello World!";
    > }
    >
    > }
    > }
    >
     
    Victor Garcia Aprea [MVP], Jan 30, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Earl Teigrob
    Replies:
    2
    Views:
    374
    Earl Teigrob
    Feb 20, 2004
  2. =?Utf-8?B?c2lhag==?=
    Replies:
    7
    Views:
    1,513
    =?Utf-8?B?c2lhag==?=
    Mar 7, 2005
  3. Ray Booysen
    Replies:
    2
    Views:
    656
    Ray Booysen
    Mar 28, 2006
  4. Sunfire
    Replies:
    2
    Views:
    323
    Sunfire
    Nov 8, 2007
  5. tshad
    Replies:
    0
    Views:
    489
    tshad
    Jun 21, 2010
Loading...

Share This Page