




已阅读5页,还剩5页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
C#网络编程技术综合实验报告三题目: B/S控件应用 院(系): 专业班级: 学 号: 学生姓名: 指导教师: 教师职称: 起止时间: B/S控件应用一、 问题描述本课程设计的目的是锻炼学生熟练掌握简单的C#窗体和控件的设计。使之能够应用Visual Studio 程序软件熟练进行web窗体小项目的编辑。希望通过本次练习提高学生使用C#语言控件解决实际问题的能力。二、 问题分析1、需要实现的系统目标a)通过Visual Studio程序软件,结合所学内容,进行C#程序web控件的编写;b)所有控件最终设计要达成之前预计实现的各项功能;c)在功能实现的基础上,力求程序控件界面美观得体;d) 练习简单应用程序开发设计及程序开发方法。F) 通过所学知识,尽量在控件中添加更多功能。2、需要实现的功能需求 通过CheckBox控件,实现事务单项选择功能,并在TextBox中显示所选内容。 实现CheckBoxList选项列表功能。 实现CheckedListBox复选框的多选内容,按钮单击显示 实现RadioButton单项选择框的任意选择,通过Web网页显示所选的内容。 编辑RadioButtonList控件,确定选择之后,在网页中显示所选内容。 进行ListBox插入信息在相应文本框中输出,并可进行相应的插入、删除操作。 实现DropDownList中下拉选择确定功能。 完成Table控件显示的网格线模式,处理表格中信息。 通过相应程序,完成通过网页浏览相关文本,并上传此信息至服务器。 完成Table控件在设计模式下向表格添加文本或控件。 掌握Web窗体设计模式与HTML模式的联合使用。 熟练在代码隐藏类中编写HTML及客户端脚本的方法。3、实验环境(本次上机实验所使用的平台和相关软件) Windows Xp 系统 + Visual Studio 2005 程序软件三、 程序设计 根据所需内容,按要求在WindowsApplication中添加ASP.NET Web控件。 选择工具箱,按需求选择窗体控件添加,如图, 控件名称图2-1 用于多选框选择文字输入,CheckBox控件 图2-2 RadioButton控件所实现的单项选择功能图2-3 RadioButtonList选择框及其效果图2-4 ListBox控件,实现向列表框中插入和删除信息功能 图2-5 DropDownList控件,实现下拉菜单选择功能图2-6 Table控件,运行结果如图图2-7 File Field控件,实现选择上传文件功能 为每个控件添加所需的程序 编辑完毕,运行程序,效果如图:四、 程序实现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 _123/ / WebForm1 的摘要说明。/ public class WebForm1 : System.Web.UI.Pageprivate void Page_Load(object sender, System.EventArgs e)if(!Page.IsPostBack)ListItem stra= new ListItem(操作系统),new ListItem(数据结构),new ListItem(数据库);DropDownList1.Items.AddRange(stra);if(!Page.IsPostBack)ListItem item=new ListItem10;for(int i=0;iitem.Length;i+)itemi=new ListItem(选项+i.ToString();CheckBoxList1.Items.AddRange(item);#region Web 窗体设计器生成的代码override protected void OnInit(EventArgs e)/ CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。InitializeComponent();base.OnInit(e);/ / 设计器支持所需的方法 - 不要使用代码编辑器修改/ 此方法的内容。/ private void InitializeComponent() this.Button1.Click += new System.EventHandler(this.Button1_Click);this.TextBox1.TextChanged += new System.EventHandler(this.TextBox1_TextChanged);this.Button2.Click += new System.EventHandler(this.Button2_Click);this.Button3.Click += new System.EventHandler(this.Button3_Click);this.Button4.Click += new System.EventHandler(this.Button4_Click);this.Button5.Click += new System.EventHandler(this.Button5_Click);this.Button6.Click += new System.EventHandler(this.Button6_Click);this.Button7.Click += new System.EventHandler(this.Button7_Click);this.Button8.Click += new System.EventHandler(this.Button8_Click);this.Button9.Click += new System.EventHandler(this.Button9_Click);this.Load += new System.EventHandler(this.Page_Load);#endregionprivate void Button1_Click(object sender, System.EventArgs e)Response.Write(window.confirm(ok?););private void TextBox1_TextChanged(object sender, System.EventArgs e)Response.Write(window.alert(+this.TextBox1.Text+);private void Button2_Click(object sender, System.EventArgs e)string str=选择结果:;if(CheckBox1.Checked=true) str+=CheckBox1.Text+、;if(CheckBox2.Checked=true) str+=CheckBox2.Text+、;if(CheckBox3.Checked=true) str+=CheckBox3.Text+、;if(strstr.Length-1=、) str=str.Substring(0,str.Length-1);TextBox2.Text=str;private void Button3_Click(object sender, System.EventArgs e)string str=选择结果:;for(int i=0;iCheckBoxList1.Items.Count;i+)if(CheckBoxList1.Itemsi.Selected)str+=CheckBoxList1.Itemsi.Text+、;if(strstr.Length-1=、) str=str.Substring(0,str.Length-1);Response.Write(window.alert(+str+););Response.Write(window.alert(+this.TextBox1.Text+);private void Button4_Click(object sender, System.EventArgs e)string str=你选择的是:;if(RadioButton1.Checked)str+=RadioButton1.Text;else if(RadioButton2.Checked)str+=RadioButton2.Text;else if(RadioButton3.Checked)str+=RadioButton3.Text;Response.Write(window.alert(+str+);private void Button5_Click(object sender, System.EventArgs e)string str=你选择的是:;if(RadioButtonList1.SelectedIndex-1)str+=RadioButtonList1.SelectedItem.Text;Response.Write(window.alert(+str+);private void Button6_Click(object sender, System.EventArgs e)/插入非重复条目bool ifExist=false;if (TextBox3.Text!=) /for语句用来查找是否有重复条目,ListBox1.Items.Count代表列表框中/条目的个数for(int i=0;i=0;i-)if(ListBox1.Itemsi.Selected)ListBox1.Items.Remove(this.ListBox1.Itemsi);private void Button8_Click(object sender, System.EventArgs e)Table1.Rows.Clear();AddRow(搜狐企业在线,,包括招商引资、企业报道等信息。);AddRow(263在线,,包括娱乐、生活、旅游等信息。);private void AddRow(string str1,string url,string str2)TableRow row=new TableRow();HyperLink hyperlink=new HyperLink();hyperlink.Text=str1;hyperlink.NavigateUrl=url;hyperlink.Target=_top;TableCell cell1=new TableCell();cell1.Font.Size=FontUnit.XSmall;cell1.Controls.Add(hyperlink);row.Cells.Add(cell1);TableCell cell2=new TableCell();cell2.Font.Size=FontUnit.XSmall;cell2.ForeColor=Color.Blue;cell2.Text=str2;row.Cells.Add(cell2);Table1.Rows.Add(row);private void Button9_Click(object sender, System.EventArgs e)if(DropDownList1.SelectedIndex-1)Response.Write(window.alert(你选择的是:+DropDownList1.SelectedItem.Text+););private void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)if(DropDownList1.SelectedIndex-1)Label1.Text=DropDownList1.SelectedI
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 黑龙江商业职业学院《智能科学与技术专业导论》2024-2025学年第一学期期末试卷
- 广西中远职业学院《虚拟现实开源系统开发》2024-2025学年第一学期期末试卷
- 沈阳城市建设学院《数据组织与管理》2024-2025学年第一学期期末试卷
- 武汉纺织大学《生活适应的设计与教学》2024-2025学年第一学期期末试卷
- 江西制造职业技术学院《微分方程应用》2024-2025学年第一学期期末试卷
- 江西财经职业学院《水资源规划》2024-2025学年第一学期期末试卷
- 南京科技职业学院《动画声音》2024-2025学年第一学期期末试卷
- 零售店铺店长管理手册
- 新概念英语综合测试卷解析
- 浙江汽车职业技术学院《国际贸易理论与实务(一)》2024-2025学年第一学期期末试卷
- 医院患者病情评估制度
- 钢栏杆安装工程施工方案
- 2025年幼儿教师师德培训案例集
- GB/T 33130-2024高标准农田建设评价规范
- 养老院老人权益保护制度
- 高空作业车安全知识培训
- 吉林大学《计算机网络(双语)》2021-2022学年期末试卷
- 《解除保护性止付申请书模板》
- 2024年云网安全应知应会考试题库
- 高层建筑火灾扑救
- 南京大学介绍
评论
0/150
提交评论