第一个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 ...
随机推荐
- .NET 随记
1. goto 常用于 switch语句中2. 字符串相加用 StringBuilder的Append()方法性能好3. str.Trim(',') 清除字符串后的","4. st ...
- JSON字符串和JS对象
JSON和JS对象 一 JSON是什么 JSON是基于文本的,轻量的,用于数据交换的,一种格式. 可以看到JSON的定义里面有很多的定语,现在就每个限定解释一下: 1. 基于文本 这里的意思是相对于哪 ...
- Windows定时关机
用shutdown命令.开始菜单>运行,输入shutdown -s -t 7200 (两个小时之后关机)at 12:00 shutdown -s (12:00关机) 其他设置:shutdown ...
- scrapy架构初探
scrapy架构初探 引言 Python即时网络爬虫启动的目标是一起把互联网变成大数据库.单纯的开放源代码并不是开源的全部,开源的核心是"开放的思想",聚合最好的想法.技术.人员, ...
- Java IO学习笔记五
管道流 管道流的主要作用是可以进行两个线程间的通讯,分为管道输出流(PipedOutputStream).管道输入流(PipedInputStream),如果想要进行管道输出,则必须要把输出流连在输入 ...
- ubuntu忽然不能登录,输入密码正确一直返回登录界面
问题描述 由于配置eclipse命令启动,我修改了 /etc/environment 文件的内容,用命令 shutdown -r -now 重启后,输入密码正确一直返回登录界面. 查了下网上资料:系统 ...
- 验证表格多行某一input是否为空
function checkTableKeyWordVal(tableId){ var result = true; $("#"+tableId+" tbody tr&q ...
- DataTable多线程操作报错情况
最近在写一个http接口时用了DataTable这个强大的利器,接口用浏览器跑起来没任何问题.当时也没考虑并发问题,后来用一个压力测试工具做大并发测试,1000+/s次速度测试.发现程序报错了.程序报 ...
- RDLC报表纵向合并单元格。
在做RDLC报表时发现居然没有纵向合并单元格,震惊! 网上查了一些资料,有些方法很可爱,采用去除边框法,但是用这种方法如果要求文本属性居中的话那则达不到美观效果,还有些复杂一点的方法,我都没耐心看,然 ...
- PHP加密解密的函数
<?php class Encryption { /* *功能:对字符串进行加密处理 *参数一:需要加密的内容 *参数二:密钥 */ function encrypt($str,$key){ / ...