By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,290 Members | 1,481 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,290 IT Pros & Developers. It's quick & easy.

Problem with Visual Studios 2005 using C# and ASPX

P: 2
Please excuse my simple question.

I have the following C#.NET code.

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)

protected void Button1_Click(object sender, EventArgs e)
Label1.Text = "Button1 clicked";


================================================== =====

Now I have the following ASPX code.

%@ Page Language="C#" AutoEventWireup="true" CodeFile="WebForm1.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="" >
<head runat="server">
<title>Untitled Page</title>
<form id="form1" runat="server">
<asp:Button ID="Button1" runat="server" Height="40px" Text="Get Data" Width="88px" OnClick=Label1/>
<asp:Button ID="Label1" runat="server" Height="25px" Width="200px" />

================================================== ==

Have two basic questions.

1. Should Visual Studios automatically generate the code in the ASPX section to connect Label1 to Button1? If the answer is yes then what could be the configuration setting I am missing.

2. If the answer is NO then what is the code to connect BUTTON1 to LABEL1?

Please overlook the fact I am very new at these languages.
Sep 30 '06 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.