radiobutton实例的编译错误【新手提问】

looker520 2005-10-08 09:15:13
WebForm3.aspx

<%@ Page language="c#" Codebehind="WebForm3.aspx.cs" AutoEventWireup="false" Inherits="WebService1.WebForm3" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm3</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<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 MS_POSITIONING="GridLayout">
<p><font face="verdana">RadioButton实例</font></p>
<form ID="Form1" method="post" runat="server">
<h4>选择你的工资水平</h4>
<asp:RadioButton ID="Radio1" Runat="server" GroupName="RadioGroup1" Checked="True" Text="金额"></asp:RadioButton>
<i>(>10000RMB/月</i>
<p>
<asp:RadioButton ID="Radio2" Runat="server" GroupName="RadioGroup1" Text="白领"></asp:RadioButton>
<i>(5000-9999RMB/月)</i>
</p>
<p>
<asp:RadioButton ID="Radio3" Runat="server" GroupName="RadioGroup1" Text="蓝领"></asp:RadioButton>
<i>(2000-4999/月)</i>
</p>
<asp:Button ID="Button1" Runat="server" Text="提交"></asp:Button>
<br>
<br>
<asp:Label ID="Label1" Runat="server" Font-Bold="true"></asp:Label>
</form>
</body>
</HTML>



WebForm3.aspx.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 WebService1
{
/// <summary>
/// WebForm3 的摘要说明。
/// </summary>
public class WebForm3 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.RadioButton Radio1;
protected System.Web.UI.WebControls.RadioButton Radio2;
protected System.Web.UI.WebControls.RadioButton Radio3;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Label Label1;

private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
}

#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </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)
{
if (Radio1.Checked)
{
Label1.Text="你的选择是:"+Radio1.Text;
}
else if(Radio2.Checked)
{
Label1.Text="你的选择是:"+Radio2.Text;
}
else if(Radio3.Checked)
{
Label1.Text="你的选择是:"+Radio3.Text;
}
}


}
}


总是报错不知道是怎么回事?求教一下
...全文
37 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
seesea125 2005-10-08
  • 打赏
  • 举报
回复
报什么错?

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧