标准Web服务器控件的使用.docVIP

  • 15
  • 0
  • 约6.12千字
  • 约 9页
  • 2018-01-04 发布于河南
  • 举报
标准Web服务器控件的使用

一.实验环境 一台装有Microsoft Visual Studio 2008的电脑 二.实验内容、核心页面及程序代码 1.实验内容 1. 编写一个Web应用程序Login,该程序用于检查用户登录信息。当用户输入正确密码时,显示消息“***,您的登录信息正确!”。否则,显示消息“***,您的登录信息不正确!”。要求密码用********显示。 2. 用CheckBox控件实现如下界面: 3. 编写一个可以选择个人爱好的程序,分别用ListBox,DropDownList,RadioButton,RadioButtonList实现。 4. 完成如下选择城市的程序,要求单击向左箭头时,把右边ListBox中选中的项移到左边的ListBox中,单击向右箭头时,把左边ListBox中选中的项移到右边的ListBox中。 5. 综合应用各种控件实现如下填写个人信息的界面: 2.核心页面及代码 1、登陆页面 核心页面: 核心代码 public partial class _Default : System.Web.UI.Page { string name = mike; string passWord = mike; protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { if (TextBoxUName.Text.ToString() == name TextBoxPass.Text.ToString() == passWord) { Response.Write(登陆成功); } else { Response.Write(登陆信息错误); } } } 2、总价计算 核心页面: 核心代码: protected void LinkButton1_Click(object sender, EventArgs e) { int num=int.Parse(TextBox1.Text.ToString()); double price=double.Parse(TextBox2.Text.ToString()); if (CheckBox1.Checked) { Response.Write(总价(含税):+num*price*1.04); } else { Response.Write(总价: + num * price); } } 3、编写一个可以选择个人爱好的程序 核心页面: 核心代码: (1)ListBox实现 protected void Button1_Click(object sender, EventArgs e) { string show = 您的选择是:; switch(ListBox1.SelectedIndex) { case 0: Response.Write(show+篮球); break; case 1: Response.Write(show+足球); break; case 2: Response.Write(show+羽毛球); break; case 3: Response.Write(show+兵乓球); break; default: break; } } (2)DropDownList实现 protected void Button1_Click(object sender, EventArgs e) { string show = 您选择的是:; switch

文档评论(0)

1亿VIP精品文档

相关文档