加到100,这么简单的问题没人会吗??
aspx文件:
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApplication1.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body>
<form id="Form1" runat="server">
<FONT face="宋体">操作数1:
<asp:TextBox id="Operand1" runat="server"></asp:TextBox><br>
操作数2:
<asp:TextBox id="Operand2" runat="server"></asp:TextBox><br>
<br>
<asp:Button id="Button1" runat="server" Text="加"></asp:Button>
<asp:TextBox id="Result" runat="server"></asp:TextBox>
</FONT>
</form>
</body>
</HTML>
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 WebApplication1
{
/// <summary>
/// WebForm1 的摘要说明。
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox Operand1;
protected System.Web.UI.WebControls.TextBox Operand2;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.TextBox Result;
private void Page_Load(object sender, System.EventArgs e)
{
}
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
private void Button1_Click(object sender, System.EventArgs e)
{
Result.Text ="aaa";
}
}
}
点按钮什么反映都没有,也不报错误!!
问题点数:100、回复次数:4Top
1 楼hgknight(江雨.net)回复于 2002-11-05 14:22:25 得分 100
在cs文件中加上函数
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}Top
2 楼gshope(北京.Net)回复于 2002-11-05 14:26:19 得分 0
可以了,谢谢:)请你给我解释一下好吗?我刚学C#Top
3 楼baitianhai(hong)回复于 2002-11-05 14:26:38 得分 0
我这里没有问题的亚,你象达到什么目的那Top
4 楼jb2008(飞天.net)回复于 2002-11-05 14:36:54 得分 0
Button上加一个 OnClick="Button1_Click"
protected void Button1_Click()Top




