ASP NET动态网站开发基础教程习题答案(2)

2019-01-19 13:20

{

protected void Page_Load(object sender, EventArgs e) {

Label1.Text = Session[\} }

3、在ex_3_1.aspx.cs文件中的代码如下所示: public partial class _ex_3_1 : System.Web.UI.Page {

protected void Page_Load(object sender, EventArgs e) {

HttpCookie cookie1 = Request.Cookies[\if (cookie1 == null) {

//创建一个cookie实例

HttpCookie cookie = new HttpCookie(\

//添加要存储的信息,采用键/值结合的方式 cookie.Values.Add(\

cookie.Expires = DateTime.Now.AddYears(1);

//把cookie加如当前的页面的Response对象里面 Response.Cookies.Add(cookie);

Response.Redirect(\} else {

Response.Write(cookie1.Values[\} } }

Chap04参考答案 一、填空题

1、System.Web.UI.WebControls

2.设置是否自动向服务器发送数据 false

用户单击此控件时并不导致向服务器发送页面。 3.编程方式 运行时更改页面中的文本 4.标头 标题 链接 链接 5.图像 作用点控件的集合 二、1.D 2.B 3.D 4.C 5.D 三、上机操作题

1、在ex4_1.aspx文件中代码如下所示: <%@ Page Language=\AutoEventWireup=\Inherits=\

CodeFile=\1.0

Transitional//EN\

演示ComboBox控件的使用

ex4_2.aspx.cs的代码如下所示:

public partial class ex4_2 : System.Web.UI.Page {

protected void Page_Load(object sender, EventArgs e) { }

protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) {

if (!e.Day.IsOtherMonth && !e.Day.IsWeekend) e.Cell.BackColor = System.Drawing.Color.Yellow; else if (!e.Day.IsOtherMonth && e.Day.IsWeekend) {

e.Cell.BackColor = System.Drawing.Color.Red; e.Day.IsSelectable = false; } } }

3、在ex4_3.aspx文件中代码如下所示:

在ex4_3.aspx.cs文件中代码如下所示:

public partial class ex4_3 : System.Web.UI.Page {

protected void Page_Load(object sender, EventArgs e) { }

BulletStyle=\protected void ItemsBulletedList_Click(object sender, BulletedListEventArgs e) {

switch (e.Index) {

case 0:

Label1.Text = \百度\break; case 1:

Label1.Text = \谷歌\break; case 2:

Label1.Text = \新浪\break; } } }

Chap05参考答案 一、填空题

1、客户端数据验证 服务器端数据验证 2、RequiredFieldValidator 3、CompareValidator

4、RegularExpressionValidator 5、.ascx

二、1.D 2. D 3.ABCD 4、C 5、AB 三、上机操作题

1、ex5_1.aspx的源代码如下: <%@ Page Language=\AutoEventWireup=\Inherits=\

CodeFile=\1.0

Transitional//EN\

数字输入

请输入:

2、ex5_2.aspx的源代码如下:

<%@ Page Language=\AutoEventWireup=\CodeFile=\Inherits=\判断日期

请输入日期:

3、身份验证用户控件的源代码如下:

<%@ Control Language=\AutoEventWireup=\CodeFile=\Inherits=\

ErrorMessage=\您输入的身份证号码有误,请重新输入!\ValidationExpression=\

ex5_3.aspx的源代码如下: <%@ Page Language=\AutoEventWireup=\CodeFile=\Inherits=\

<%@ Register src=\

输入身份证号码

请输入您的身份证号码:

             &n


ASP NET动态网站开发基础教程习题答案(2).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:2010年下半年中国银行业从业人员资格认证考试--真题&答案

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: