第一个asp.net实例——生日邀请以及回函
22回校后,看了论文游了西湖,今天开始接触asp.net,从图书馆选了两本书:《精通ASP.NET 4.5 (第五版)》,《ASP.NET全能速查手册》。一本练手细看,一本翻查。
跟着第一章敲,顺便学VS2012。实例包括文件
- Default.aspx作为主页面,页面内容包括表单的文本域,下拉选项,以及重要的提交按钮。
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfkAAAFACAIAAAAwEZIOAAAgAElEQVR4nO2dW3Ac15mYzxOmiqgiyKLxIGNl2qJddAXRjqqIeBFRqpisRNKKVYiUMsnSihNxA0mBnGXZYqxyhQ6BXacYe2wvE6/IDeMLdIEvSxG0pgyRuysLK9G0KEUWaSOEApNFiRJAKyNIQfKAh3nrPHTPzLn1babRPWh8X+GBnO4+ffr0f74+/ffpGeEAAEDeEVlXAAAAVhxcDwCQf3A9AED+wfUAAPkH1wMA5B9cDwCQf3A9AED+wfUAAPkH1wMA5B9cDwCQf3A9AED+wfUAAPkH1wMA5B9cDwCQf3A9AED+wfUAAPkH1wMA5B9cDwCQf3A9AED+wfUAAPkH1wMA5B9cDwCQf3A9AKwCalcnR7b1FIQQ3b2DI5NXa1lXaLUR7vrZclEoFHaceDvOFqVKUpVNhbePbdeO9/6fLkVcd2Op4rdqh6Ccm4Gjv1u5PVVKIhqrLD6yQGvLNdli5w72Ko2wZexNebHcRIXhM+3t67VDN+ewwVtwvRCFoYlq9C1WW0MtVUob1ePdfsx+cXtzbEtQ+HUitcm9KZ0ZXJ8cuN6iIbUVZo70N5YUy7PJ7iwfDd6S64XYuHfS3/ar3PWmw+0Sr734mHJNCBj/dxCyNnD9SrK8OHfhufLjQ4O9I+0eIa4PHVjJ0sH1Vlp0vRC9w2f8zLbqXe9UJ4YKytFufOxFPT249NP7lXVWwaDecRxn+kDjAtV2lwhkLbv+198Y7O1O8AhxvePm691m7e4dPHh2Qe2Q8yd2JNc+uF6j98C0/fHI6ne9MWY3B+1aqn51DOod5eSk6vqV3VmHkbSbcX04U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IP/gegCA/IPrAQDyD64HAMg//x9fPM8J0YjKIQAAAABJRU5ErkJggg==" alt="" />
aspx文件本质上还是html文件,只在页头附加<%和%>标签的元素声明,head以及form元素中添加runat="server"。
- aspx作为呈现内容,并未有与服务器沟通的实质性代码,此时利用<%和%>内的CodeBehind特性,启用aspx文件相应的隐藏文件,后缀名为aspx.cs的文件。该代码隐藏类的基础是System.Web.UI.Page,其中包含许多用于响应Web请求的方法和属性。在Default.aspx.cs代码隐藏文件中,利用在初次加载页面时就会被调用,并在用户提交窗体时再次被调用的Page_Load方法,对用户是否参加晚会进行判断,从而转向相应的结果页面。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.ModelBinding; namespace PartyInvites{
public partial class Default : System.Web.UI.Page{
protected void Page_Load(object sender, EventArgs e){
if (IsPostBack){
GuestReponse rsvp = new GuestReponse();
if(TryUpdateModel(rsvp,new FormValueProvider(ModelBindingExecutionContext))){
ResponseRepository.GetRepository().AddResponse(rsvp);
if(rsvp.WillAttend.HasValue && rsvp.WillAttend.Value){
Response.Redirect("seeyouthere.html");
}else{
Response.Redirect("sorryyoucantcome.html");
}
}
}
}
}
}
Default.aspx.cs
- 在此实例中涉及到数据存储,但为了快捷方便,直接向对象存储在内存中。在此是利用类文件GuestReponse.cs完成,并且简单的利用数据模型类应用特性来实现验证。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations; /// <summary>
/// GuestReponse 的摘要说明
/// </summary>
namespace PartyInvites
{
public class GuestReponse
{
[Required]
public string Name { get; set; }
[Required]
public string Email { get; set; }
[Required]
public string Phone { get; set; }
[Required(ErrorMessage="Please tell us if you will attend")]
public bool? WillAttend { get; set; }
}
}
GuestReponse.cs
- ResponseRepository.cs读取实例中的所有数据对象,并向其中添加新对象。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web; /// <summary>
/// ResponseRepository 的摘要说明
/// </summary>
namespace PartyInvites
{
public class ResponseRepository
{
private static ResponseRepository repository = new ResponseRepository();
private List<GuestReponse> responses = new List<GuestReponse>(); public static ResponseRepository GetRepository()
{
return repository;
}
public IEnumerable<GuestReponse> GetAllResponses()
{
return responses;
}
public void AddResponse(GuestReponse response)
{
responses.Add(response);
} }
}
ResponseRepository.cs
- 实例中另一重要文件Summary.aspx以及其代码隐藏文件Summary.aspx.cs将参加聚会与不参加聚会的人员信息做出总结,两个表格的数据调用方式有些区别,前者直接在页面中包含代码,后者将aspx.cs中所含调用方法的结果利用<%=和%>插入到发送给浏览器的输出中。
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Summary.aspx.cs" Inherits="PartyInvites.Summary" %>
<%@ Import Namespace="PartyInvites" %>
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<link rel="stylesheet" href="StyleSheet.css" />
</head>
<body>
<h2>RSVP Summary</h2> <h3>People Who Will Attend</h3>
<table>
<thead>
<tr><th>Name</th><th>Email</th><th>Phone</th></tr>
</thead>
<tbody>
<% var yesData = ResponseRepository.GetRepository().GetAllResponses().Where(r => r.WillAttend.HasValue && r.WillAttend.Value);
foreach (var rsvp in yesData){
string htmlString = String.Format("<tr><td>{0}</td><td>{1}</td><td>{2}</td></tr>", rsvp.Name, rsvp.Email, rsvp.Phone);
Response.Write(htmlString);
}
%>
</tbody>
</table>
<h3>People Who Will Not Attend</h3>
<table>
<thead>
<tr><th>Name</th><th>Name</th><th>Phone</th></tr>
</thead>
<tbody>
<%= GetNoShowHtml() %>
</tbody>
</table>
</body>
</html>
Summary.aspx
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text; namespace PartyInvites
{
public partial class Summary : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ }
protected string GetNoShowHtml() {
StringBuilder html = new StringBuilder();
var noData = ResponseRepository.GetRepository().GetAllResponses().Where(r => r.WillAttend.HasValue && !r.WillAttend.Value);
foreach(var rsvp in noData){
html.Append(String.Format("<tr><td>{0}</td><td>{1}</td><td>{2}</td></tr>", rsvp.Name, rsvp.Email, rsvp.Phone));
}
return html.ToString();
}
}
}
Summary.aspx.cs
第一个asp.net实例——生日邀请以及回函的更多相关文章
- 【Asp.net入门07】第一个ASP.NET 应用程序-创建数据模型和存储库
1.理解概念 先理解一下两个概念. 模型 模型是指数据的结构类型,以及可调用的方法.对面向对象编程方法来说,其实就是类.模型类就是一个描述数据的类.只有把数据按一定方式描述出来,我们才能在程序中方便地 ...
- 在一个空ASP.NET Web项目上创建一个ASP.NET Web API 2.0应用
由于ASP.NET Web API具有与ASP.NET MVC类似的编程方式,再加上目前市面上专门介绍ASP.NET Web API 的书籍少之又少(我们看到的相关内容往往是某本介绍ASP.NET M ...
- 第一个 Asp.Net vNext 应用程序
要说免费的虚拟主机的话,最好的服务商应该就是Microsoft Azure(不是Windows Azure由世纪互联运营),提供免费的1GB .NET/Java/Python/Php空间,日流量有限制 ...
- WCF技术剖析之一:通过一个ASP.NET程序模拟WCF基础架构
原文:WCF技术剖析之一:通过一个ASP.NET程序模拟WCF基础架构 细算起来,已经有好几个月没有真正的写过文章了.近半年以来,一直忙于我的第一本WCF专著<WCF技术剖析>的写作,一直 ...
- NHibernate构建一个ASP.NET MVC应用程序
NHibernate构建一个ASP.NET MVC应用程序 什么是Nhibernate? NHibernate是一个面向.NET环境的对象/关系数据库映射工具.对象/关系数据库映射(object/re ...
- 一个ASP.NET Web API 2.0应用
在一个空ASP.NET Web项目上创建一个ASP.NET Web API 2.0应用 由于ASP.NET Web API具有与ASP.NET MVC类似的编程方式,再加上目前市面上专门介绍ASP.N ...
- 第一个asp.net MVC5+ExtJS6入门案例项目
最近在学习asp.net MVC,结合前段时间学习的ExtJS,做了一个入门示例.不过还有一个json日期显示的问题没有解决. [思路] 1.先搭建一个asp.net MVC项目. 2.将MVC项目的 ...
- Kubernetes初探[1]:部署你的第一个ASP.NET Core应用到k8s集群
Kubernetes简介 Kubernetes是Google基于Borg开源的容器编排调度引擎,作为CNCF(Cloud Native Computing Foundation)最重要的组件之一,它的 ...
- 2019年第一天——使用Visual Studio 2019 Preview创建第一个ASP.Net Core3.0的App
一.前言: 全文翻译自:https://www.talkingdotnet.com/creating-first-asp-net-core-3-0-app-visual-studio-2019/ Vi ...
随机推荐
- java基础之集合篇
(一) 集合类位于JDK中java.util包中. 常用的集合类型分布在java.util.Collection和java.util.Map接口中. java.util.Collection=> ...
- C++实现密码强度测试
最近在博客中看到许多用js写的密码强度检测,我觉得挺有意思的,所以呢我打算自己也写个来玩玩,最可悲的是我还没学js,当然这不重要,所以呢打算用C++来写一个密码强度检测,这里我来给大家说说用JS写的和 ...
- (cljs/run-at (->JSVM :browser) "语言基础")
前言 两年多前知道cljs的存在时十分兴奋,但因为工作中根本用不上,国内也没有专门的职位于是搁置了对其的探索.而近一两年来又刮起了函数式编程的风潮,恰逢有幸主理新项目的前端架构,于是引入Ramda. ...
- python网络爬虫之初始网络爬虫
第一次接触到python是一个很偶然的因素,由于经常在网上看连载小说,很多小说都是上几百的连载.因此想到能不能自己做一个工具自动下载这些小说,然后copy到电脑或者手机上,这样在没有网络或者网络信号不 ...
- Linux命令 用户管理命令
groupadd [功能说明] 新建用户组 [语法格式] Groupadd[-f][-r][-g<GID><-o>][组名] [选项参数] 参数 说明 -f 建立已存在的组,强 ...
- Java线程池入门必备
线程池 一. 线程池的简介 1.什么是线程池? 最早期的工作线程处理任务的模型.一个任务的到来,会伴随着线程的创建,当处理完任务后,线程会被销毁,资源回收.这种一个任务一个线程一系列创建销毁的模式 ...
- 使用websocket-sharp来创建c#版本的websocket服务
当前有一个需求,需要网页端调用扫描仪,javascript不具备调用能力,因此需要在机器上提供一个ws服务给前端网页调用扫描仪.而扫描仪有一个c#版本的API,因此需要寻找一个c#的websocket ...
- 分布式架构实战--ActiveMQ的安装与使用(单节点)
具体内容请参考样例代码和视频教程: http://www.roncoo.com/course/view/85d6008fe77c4199b0cdd2885eaeee53 IP:192.168.4.10 ...
- java怎么发http请求
package wzh.Http; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStr ...
- MaintainableCSS 《可维护性 CSS》 --- 复用篇
复用 通常,Harry Roberts 所说的 DRY (Don't repeat yourself) 经常被曲解成永远不要重复做通一件事. 但实际上这是不现实的,而且常常导致过分抽象,用太多的精力去 ...