- 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
您可能关注的文档
- javax.servlet.http使用帮助.doc
- arcgis for server 10.1 rest api新特性.docx
- HttpWebRequest、HttpWebResponse封装类源码.docx
- REST 入门介绍.doc
- RestApi开发规范.docx
- Advanced REST client的使用说明以及安装.docx
- restful webservice构建小例子(restlet).docx
- Restlet开发指南.doc
- REST和JAX-RS知识介绍.doc
- REST架构笔记.docx
- 广东省广州省实验中学教育集团2025-2026学年八年级上学期期中考试物理试题(解析版).docx
- 广东省广州大学附属中学2025-2026学年八年级上学期奥班期中物理试题(解析版).docx
- 广东省广州市第八十六中学2025-2026学年八年级上学期期中物理试题(含答案).docx
- 广东省广州市第八十九中学2025-2026学年八年级上学期期中考试物理试题(解析版).docx
- 广东省广州市第二中学2025-2026学年八年级上学期期中考试物理试题(含答案).docx
- 广东省广州市第八十六中学2025-2026学年八年级上学期期中物理试题(解析版).docx
- 广东省广州市第八十九中学2025-2026学年八年级上学期期中考试物理试题(含答案).docx
- 广东省广州市第二中学2025-2026学年八年级上学期期中考试物理试题(解析版).docx
- 2026《中国人寿上海分公司营销员培训体系优化研究》18000字.docx
- 《生物探究性实验教学》中小学教师资格模拟试题.docx
原创力文档

文档评论(0)