【Asp.net精品源码栏目提醒】:网学会员在Asp.net精品源码频道为大家收集整理了“ASP_NET课后习题答案 - 大学课件“提供大家参考,希望对大家有所帮助!
Chap01 参考答案一、填空题1、Web XML Web services2、公共语言运行库、.NET Framework 类库3、属性 方法 事件4、aspx5、cs二、选择题1、ABCD 2、ABCD 3、AB 4、A 5、B三、上机操作题1、参考 1.3.1。
2、参考 1.4.2。
3、在 ex1_1.aspx 文件中的代码如下所示:ltbodygt ltform idquotform1quot runatquotserverquotgt ltdivgt ltasp:Button IDquotButton1quot runatquotserverquot OnClickquotButton1_Clickquot Textquot提交quot/gtltbr /gt ltasp:Label IDquotLabel1quot runatquotserverquot Textquot您单击了 0 次按钮quotWidthquot194pxquotgtlt/asp:Labelgtlt/divgt lt/formgtlt/bodygt在 ex1_1.aspx.cs 中的代码如下所示:public partial class _Default : System.Web.UI.Page private static int i protected void Page_Loadobject sender EventArgs e ifPage.IsPostBack i 0 protected void Button1_Clickobject sender EventArgs e ii1 Label1.Text quot您单击了quoti.ToStringquot次按钮quot Chap02 参考答案一、填空题1、引用类型2、object3、显式4、多态性5、初始化语句右侧二、选择题1、AC 2、A 3、B 4、B 5、AC三、上机操作题1、本习题的源代码如下:namespace ex2_1 struct student public string name public string address public string tel class Program static void Mainstring args student stu new student5 for int i 0 i lt 5 i stui.name Console.ReadLine stui.address Console.ReadLine stui.tel Console.ReadLine for int i 0 i lt 5 i Console.WriteLinei.ToString Console.WriteLinestui.name Console.WriteLinestui.address Console.WriteLinestui.tel Console.ReadLine 2、本习题的源代码如下:namespace ex2_2 class Program static void sortint a int n int temp for int i 1 i lt n i for int j 0 j lt n - i j if aj gt aj 1 temp aj aj aj 1 aj 1 temp static void Mainstring args int n 5 int a new int5 for int i 0 i lt 5 i ai Convert.ToInt32Console.ReadLine sorta n for int i 0 i lt 5 i Console.WriteLineai.ToString Console.ReadLine 3、本习题的源代码如下:namespace ex2_3 class student protected string m_name protected string m_sex protected float m_tuition public studentstring strname string strsex float ftuition m_name strname m_sex strsex m_tuition ftuition virtual public void printfInfo Console.WriteLinem_name quot quot m_sex quot quot m_tuition.ToString class graduate : student protected string m_tutor public graduatestring strname string strsex float ftuitionstringstrtutor:basestrnamestrsexftuition m_tutor strtutor override public void printfInfo base.printfInfo Console.WriteLinequot导师是quotm_tutor class Program static void Mainstring args student s new studentquot张三quot quot男quot 5000 graduate g new graduatequot李四quot quot女quot 9000 quot王五quot s.printfInfo g.printfInfo Console.ReadLine Chap03 参考答案一、填空题1、HttpResponse2、客户端3、服务器4、状态变量5、用户会话二、选择题1、C 2、ABCD 3、ABCD 4、AD三、上机操作题1、在 ex_1_1.aspx 文件中的代码如下所示:ltbodygt ltform idquotform1quot runatquotserverquotgt ltdivgt ltasp:Button IDquotButton1quot runatquotserverquot OnClickquotButton1_Clickquot Textquot提交quot/gtlt/divgt lt/formgtlt/bodygt在 ex_1_1.aspx.cs 文件中的代码如下所示:public partial class _Default : System.Web.UI.Page protected void Page_Loadobject sender EventArgs e protected void Button1_Clickobject sender EventArgs e Response.Redirectquotex_1_2.aspxname张三quot 在 ex_1_2.aspx.cs 文件中的代码如下所示:public partial class ex_1_2 : System.Web.UI.Page protected void Page_Loadobject sender EventArgs e Response.WriteRequest.QueryStringquotnamequot 2、在 ex2_1.aspx 文件中的代码如下所示:ltbodygt ltform idquotform1quot runatquotserverquotgt ltdivgt ltasp:Button IDquotButton1quot runatquotserverquot OnClickquotButton1_Clickquot Textquot提交quot/gtlt/divgt lt/formgtlt/bodygt在 ex_2_1.aspx.cs 文件中的代码如下所示:public partial class __ex_2_1 : System.Web.UI.Page protected void Page_Loadobject sender EventArgs e protected void Button1_Clickobject sender EventArgs e Sessionquotnamequot quot李四quot Response.Redirectquotex_2_2.aspxquot 在 ex_2_2.aspx 文件中的代码如下所示:ltbodygt ltform idquotform1quot runatquotserverquotgt ltdivgt ltasp:Label IDquotLabel1quot runatquotserverquot TextquotLabelquotWidthquot143pxquotgtlt/asp:Labelgtlt/divgt lt/formgtlt/bodygt在 ex_2_2.aspx.cs 文件中的代码如下所示:public partial class _ex_2_2 : System.Web.UI.Page protected void Page_Loadobject sender EventArgs e Label1.Text Sessionquotnamequot.ToString 3、在 ex_3_1.aspx.cs 文件中的代码如下所示:public partial class _ex_3_1 : System.Web.UI.Page protected void Page_Loadobject sender EventArgs e HttpCookie cookie1 Request.Cookiesquottttquot if cookie1 null //创建一个 cookie 实例 HttpCookie cookie new HttpCookiequottttquot //添加要存储的信息,采用键/值结合的方式 cookie.Values.AddquotNamequot quotTomquot cookie.Expires DateTime.Now.AddYears1 //把 cookie 加如当前的页面的 Response 对象里面 Response.Cookies.Addcookie Response.Redirectquothttp://mail.163.comquot else Response.Writecookie1.ValuesquotNamequot Chap04 参考答案一、填空题1、System.Web.UI.WebControls2.设置是否自动向服务器发送数据 false用户单击此控件时并不导致向服务器发送页面。
3.编程方式 运行时更改页面中的文本4.标头 标题 链接 链接5.图像 作用点控件的集合二、1.D 2.B 3.D 4.C 5.D三、上机操作题1、在 ex4_1.aspx 文件中代码如下所示:lt Page LanguagequotCquot AutoEventWireupquottruequot CodeFilequotex4_1.aspx.csquotInheritsquotex4_1quot gtltDOCTYPE html PUBLIC quot-//W3C//DTD XHTML 1.0 Transitional//ENquotquothttp://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtdquotgtlthtml xmlnsquothttp://www.w3.org/1999/xhtmlquot gtlthead runatquotserverquotgt lttitlegt演示 ComboBox 控件的使用lt/titlegtlt/headgtltbodygt ltform idquotform1quot runatquotserverquotgt 请选择您的登录方式: ltasp:DropDownList runat quotserverquot ID quotDropDownList1quot AutoPostBack quotTruequotOnSelectedIndexChanged quotDisplayTypequotg
上一篇:
【精品】ASP新闻发布系统论文
下一篇:
村落共同体的核心架构研究