ASPNET程序设计实验册29宋媛媛Word文档格式.docx
《ASPNET程序设计实验册29宋媛媛Word文档格式.docx》由会员分享,可在线阅读,更多相关《ASPNET程序设计实验册29宋媛媛Word文档格式.docx(24页珍藏版)》请在冰豆网上搜索。
![ASPNET程序设计实验册29宋媛媛Word文档格式.docx](https://file1.bdocx.com/fileroot1/2022-11/23/e4425f1a-9846-48ae-ab32-b56aeaa0a0fc/e4425f1a-9846-48ae-ab32-b56aeaa0a0fc1.gif)
周秀娥批改时间:
一、实验目的
通过本实验让学生了解ASP.NET的集成开发环境,掌握创建Web窗体页的基本方法。
二、实验要求
熟练使用ASP.NET的集成开发环境,掌握创建Web窗体页的基本方法。
学习使用帮助文档解决问题。
三、实验设备
586以上计算机、装有相关系统软件、数据库软件和C#中文版软件。
四、实验原理、方法
上机操作。
五、实验步骤
1、表单
<
htmlxmlns="
http:
//www.w3.org/1999/xhtml"
>
headid="
Head1"
runat="
server"
<
title>
无标题页<
/title>
/head>
body>
formaction="
cgi-bin/tongji.cgi"
method="
post"
p>
请选择你最喜欢的女歌手<
/p>
selectname="
gxl"
size="
1"
optionvalue="
zh"
祖海
szy"
宋祖英
hh"
韩红
/select>
/form>
请选择你最喜欢的男歌手<
ldh"
刘德华
zxy"
张学友
lm"
黎明
您的意见对我们很重要:
textareaname="
yj"
cols="
20"
rows="
5"
请将您的意见输入此区域
/textarea>
/body>
/html>
2、CSS样式
headrunat="
styletype="
text/css"
.style1{font-family:
华文仿宋;
font-size:
36px;
font-style:
italic;
font-weight:
bold;
text-decoration:
underline;
}
.style2{text-decoration:
line-height:
80px;
letter-spacing:
25px;
vertical-align:
top;
text-indent:
60pt;
display:
block;
.style3{background-repeat:
repeat-x;
background-attachment:
fixed;
background-position:
lefttop;
background-color:
#00FFFF;
/style>
bodyclass="
style1"
第一章,网络制作基础知识<
hr>
h1class="
style2"
welcometohere!
/h1>
第一章,网络制作基础知识<
divalign=center>
h1>
&
nbsp;
3、列表
bodybgcolor="
green"
text="
yellow"
P>
红色文本,蓝色边框<
ol>
中国城市<
li>
上海<
/li>
北京<
广州<
/ol>
4、标题
最大的标题<
h3>
使用h3的标题<
/h3>
h6>
最小的标题<
/h6>
b>
黑体字<
/b>
i>
斜体字<
/i>
u>
加下划线文本<
/u>
fontsize="
+2"
color="
#ff0000"
子体大小为2,颜色为红色的文本<
/font>
5、
palign="
center"
1997-1999年考试人数统计表<
formid="
form1"
div>
tableborder="
width="
80%"
tr>
thwidth="
20%"
rowspan="
4"
valign="
middle"
统计表<
/th>
bottom"
年份<
60%"
人数<
/tr>
tdwidth="
align="
1997<
/td>
10000<
1998<
15000<
1999<
20000<
总计<
colspan="
2"
45000<
/table>
/div>
六、实验心得
从本次实验中,主要学会了如何制作一个网站。
在HTML语言中学习了一些页面格式标记、换行标记、列表标,记以及标题格式标记和图像标记、表格标记等操作。
还学会了链接标记创建超链接。
由于是第一次接触vs2008的使用,对于软件的操作还不熟悉,所以实验速度比较慢,接下来,我会多加练习。
用户界面交互及网页间的数据传递实验学时:
2014.10.2-2014.10.9实验成绩:
周秀娥批改时间:
通过本实验学生应熟练掌握和运用各种ASP.NET对象进行基本的程序设计,了解服务器控件和验证服务器控件,掌握创建服务器控件和验证服务器控件的基本方法
掌握和运用各种ASP.NET对象,掌握服务器控件和验证服务器控件属性、事件、方法。
586以上计算机、装有相关系统软件、数据库软件和VisualB中文版软件。
1、<
asp:
LabelID="
Label1"
Text="
用户名"
/asp:
Label>
TextBoxID="
TextBox1"
TextBox>
RequiredFieldValidatorID="
RequiredFieldValidator1"
ControlToValidate="
ErrorMessage="
用户名不能为空"
RequiredFieldValidator>
br/>
ButtonID="
Button1"
提交"
/>
2、
Label2"
密码"
TextBox2"
Label3"
密码验证"
TextBox3"
CompareValidatorID="
CompareValidator1"
ControlToCompare="
ControlToValidate="
ErrorMessage="
密码不一致,请重新输入"
CompareValidator>
确认"
3、组合
用户信息<
ontextchanged="
TextBox1_TextChanged"
Display="
None"
用户名不可为空"
RequiredFieldValidator2"
密码不可为空"
邮箱"
RegularExpressionValidatorID="
RegularExpressionValidator1"
您输入的格式不正确"
ValidationExpression="
\w+([-+.'
]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
RegularExpressionValidator>
注册"
ValidationSummaryID="
ValidationSummary1"
通过本实验的学习,熟练掌握和运用各种ASP.NET对象进行基本的程序设计,了解服务器控件和验证服务器控件,掌握创建服务器控件和验证服务器控件的基本方法,学会了一些基本的值传递和一些控件的应用。
在进行运行调试时,出现了一些问题,如语法错误,导致程序无法运行,在请教老师之后,成功调试了程序,很有成就感。
母版页与内容页设计实验学时:
2014.10.16-2014.10.23实验成绩:
通过本实验学生应熟练掌握母版页和内容页的创建方法。
1、练习在主题中同时包含外观和样式表
2、掌握.skin文件和.css文件的区别与联系
3、母版页和内容页的创建方法
4、从内容页中访问母版页中的内容
1、
TextBox
BackColor="
Green"
Runat="
Server"
SkinID="
BlueTextBox"
Blue"
RedTextBox"
Red"
Buttonrunat="
#33CC33"
Css样式
body
{font-family:
宋?
体¬
?
Arial,Helvetica,sans-serif;
font-size:
medium;
color:
#000000;
#FFFFFF;
centercenter;
visibility:
visible;
clear:
inherit;
网页:
>
你好,欢迎加入音乐旅行!
br>
id="
br/>
2、<
这是母版页内容!
ImageID="
Image1"
Height="
361px"
ImageUrl="
~/image/2.png"
Width="
375px"
ContentPlaceHolderID="
ContentPlaceHolder1"
ContentPlaceHolder>
ContentID="
Content1"
ContentPlaceHolderID="
head"
Content>
Content2"
PanelID="
Panel1"
这是内容页!
Panel>
3、
onclick="
Button1_Click"
show1"
Button2"
Button2_Click"
show2"
Button3"
Button3_Click"
show3"
Calendar
Calendar1"
ca1"
CssClass="
calendar1"
ca2"
CssClass="
calendar2"
ca3"
CssClass="
calendar3"
通过本次实验的学习,我主要掌握母版页和内容页的创建方法,掌握了利用.skin和.css文件的区别和联系,学会了在内容页访问母版页并修改其内容的操作,加深了对.NET的学习。
ASP.NET中的数据绑定实验学时:
8
2014.10.30-2014.11.20实验成绩:
通过本实验让学生了解ASP.NET中的数据绑定的基本概念和结构及使用方法。
熟练使用ASP.NET的数据访问方法,数据访问模型,ASP.NET数据源控件,数据绑定控件的层次结构,数据处理中的缓存机制,ASP.NET数据访问控件。
添加现有项中,选择所需要的数据库文件
1、gridview控件
后台代码:
protectedvoidGridView1_RowCreated(objectsender,GridViewRowEventArgse)
{if((e.Row.RowState&
DataControlRowState.Edit)!
=0)
{DropDownListdpl=(DropDownList)(e.Row.FindControl
("
DropDownList1"
));
}
protectedvoidGridView1_RowUpdating(objectsender,GridViewUpdateEventArgse)
{DropDownListdpl=(DropDownList)GridView1.Rows
[GridView1.EditIndex].FindControl("
DropDownList1"
);
his.SqlDataSource1.UpdateParameters["
单位编码"
].DefaultValue=dpl.SelectedValue;
2、detailview
protectedvoidDetailsView1_ItemInserting(objectsender,DetailsViewInsertEventArgse)
{stringstr=((DropDownList)DetailsView1.Rows[5].Cells[1].
FindControl("
dropdownlist2"
)).SelectedValue;
e.Values.Add("
str);
protectedvoidDetailsView1_ItemUpdating(objectsender,DetailsViewUpdateEventArgse)
e.NewValues.Add("
3、object
ObjectDataSourceID="
ObjectDataSource1"
SelectMethod="
GetData"
TypeName="
ObjectDat