ASPNET服务器控件实验报告_第1页
ASPNET服务器控件实验报告_第2页
ASPNET服务器控件实验报告_第3页
ASPNET服务器控件实验报告_第4页
ASPNET服务器控件实验报告_第5页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

ASPNET服务器控件实验报告.优选-ASP.NET实验报告题目:ASP.NET效劳器控件院系:计算机科学与工程学院【实验题目】ASP.NET效劳器控件【实验目的】1.熟悉用户控件的使用。2.熟悉导航控件的使用。3.掌握母版页的使用。【实验容】设计一个个人情况调查程序,程序启动后显示如以下图的页面。用户在填写了、选择了性别、喜爱的歌手、居住城市、个人爱好后单击"提交〞按钮后,屏幕显示用户填写或选择的数据信息。假设用户没填写就单击"提交〞按钮,屏幕显示出错提示信息;假设用户没有选择"爱好〞工程,单击"提交〞按钮,"爱好〞工程栏中显示"真可惜,你没有任何爱好!〞。翻开VisualStudio2021创立一个,在Default.aspx页面上进展页面的设计,此时可以切换到设计视图,也可以使用拆分视图方便对照。设计Web页面ASPNET服务器控件实验报告全文共9页,当前为第1页。Web页面中标题"个人情况调查〞为图片格式,在下面已经给出,请同学们右键单击下面的图片,保存到本地硬盘,再在程序过ImageMap控件添加进页面。ASPNET服务器控件实验报告全文共9页,当前为第1页。:设置对象属性Web页面中需包含以下控件,Label控件、TextBox控件、Button控件、LinkButton控件、ImageMap控件、RadioButton控件、DropDownList控件、ListItem控件、RadioButtonList控件、CheckBoxList控件等控件,并设置好每个对象的属性。开发界面如图3-1所示。图3-1程序开发界面编写事件代码运行和调试程序程序最终运行界面如图3-2所示。图3-2程序运行界面【实验代码】<%PageLanguage="C*"AutoEventWireup="true"CodeFileInherits="_Default"%><!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN"./TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="./1999/xhtml"><headrunat="server"><title>ASP.NET效劳器控件的使用</title></head><bodystyle="text-align:left"><formid="form1"runat="server">ASPNET服务器控件实验报告全文共9页,当前为第2页。<divstyle="text-align:left">ASPNET服务器控件实验报告全文共9页,当前为第2页。<asp:ImageMapID="ImageMap1"runat="server"Height="100px"Width="470px"ImageUrl="~/exp-3.jpg"></asp:ImageMap><spanstyle="font-size:16pt"><strong><br/></strong></span><tableborder="1"style="text-align:left"><tr><tdstyle="width:125px"><asp:TextBoxID="txtName"runat="server"Width="77px"></asp:TextBox></td><tdcolspan="2"style="width:329px;text-align:left"> 性别<asp:RadioButtonID="radSex1"runat="server"Checked="True"GroupName="seleSex"Text="男"/><asp:RadioButtonID="radSex2"runat="server"GroupName="seleSex"Text="女"/></td></tr><tr><tdstyle="width:125px">你喜爱的歌手是</td><tdcolspan="2"style="width:329px;text-align:left"> <asp:DropDownListID="dropSinger"runat="server">ASPNET服务器控件实验报告全文共9页,当前为第3页。<asp:ListItem>五月天</asp:ListItem>ASPNET服务器控件实验报告全文共9页,当前为第3页。<asp:ListItem>宗盛</asp:ListItem><asp:ListItem>梁静茹</asp:ListItem><asp:ListItem>惠妹</asp:ListItem><asp:ListItem>汪峰</asp:ListItem></asp:DropDownList></td></tr><tr><tdstyle="width:125px">你家住哪里</td><tdcolspan="2"style="width:329px;text-align:left"><asp:RadioButtonListID="radlHome"runat="server"RepeatColumns="4"><asp:ListItemSelected="True"></asp:ListItem><asp:ListItem></asp:ListItem><asp:ListItem></asp:ListItem><asp:ListItem>其他城市</asp:ListItem></asp:RadioButtonList></td></tr><tr><tdstyle="width:125px;height:26px">你的爱好是</td><tdcolspan="2"style="width:329px;height:26px;text-align:left">ASPNET服务器控件实验报告全文共9页,当前为第4页。<asp:CheckBoxListID="chklLike"runat="server"RepeatColumns="4">ASPNET服务器控件实验报告全文共9页,当前为第4页。<asp:ListItem>篮球</asp:ListItem><asp:ListItem>足球</asp:ListItem><asp:ListItem>上网</asp:ListItem><asp:ListItem>音乐</asp:ListItem></asp:CheckBoxList></td></tr><tr><tdstyle="width:125px;height:26px"> </td><tdcolspan="2"style="width:329px;height:26px;text-align:left"><asp:ButtonID="btnOK"runat="server"OnClick="btnOK_Click"Text="提交"/></td></tr></table><br/></div> <asp:LabelID="lblName"runat="server"></asp:Label><br/><br/> <asp:LabelID="lblHome"runat="server"></asp:Label><br/> ASPNET服务器控件实验报告全文共9页,当前为第5页。<br/>ASPNET服务器控件实验报告全文共9页,当前为第5页。 <asp:LabelID="lblLike"runat="server"></asp:Label><br/><br/><br/><br/></form></body></html>usingSystem;usingSystem.Data;usingSystem.Configuration;usingSystem.Web;usingusingusingusingusingpublicpartialclass_DefaultPage{protectedvoidPage_Load(objectsender,EventArgse){ASPNET服务器控件实验报告全文共9页,当前为第6页。this.Title="个人情况调查";ASPNET服务器控件实验报告全文共9页,当前为第6页。txtName.Focus();}protectedvoidbtnOK_Click(objectsender,EventArgse){if(txtName.Text=="){lblName.Text="<b>你必须输入!</b>";return;}stringstrSex=",strLike=";inti;if(radSex1.Checked){strSex="男";}else{strSex="女";}for{ASPNET服务器控件实验报告全文共9页,当前为第7页。if(chklLike.Items[i].Selected)ASPNET服务器控件实验报告全文共9页,当前为第7页。{strLike=strLike+chklLike.Items[i].Text+",";}}strLike=strLike.Remove(strLike.Length-1,1);lblName.Text=txtName.Text+","+strSex+","+"你喜欢的歌手是:"+dropSinger.Text;lblHome.Text="你家住在:"if(strLike=="){strLike="真可惜,你没有任何爱好!";}else{strLike="你的爱好是:"+strLike;}lblLike.Text=strLike;}}【实验结果】【实

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论