ASP第一天

/**************by Jiangong SUN*****************/

 

技术:
- SQL Server 2005 SP4 (Version 9.005057)
- ASP.NET, C#
- Entity framework / LINQ
- WCF
- SVN (ANKHSVN & TortoiseSVN)

新的概念:
- ASP (Active Server Pages)
- XSD (XML Schema Definition) : XML Schema文件描述了XML文档的结构,用于替代DTD。
- WSDL (Web service description language) :  WSDL是一种基于XML的语言,它的作用是描述和访问网页服务。WSDL 是一份XML文档。
- postback:
Each of the asp .net pages will be a separate entity with ability to process its own posted data. That is, the values of the Form are posted to the same page and the very same page can process the data. This model is called post back.
Each Asp .net page when loaded goes through a regular creation and destruction cycle like Initialization, Page load etc., in the beginning and unload while closing it. This Postback is a read only property with each Asp .Net Page (System.Web.UI.Page) class. This is false when the first time the page is loaded and is true when the page is submitted and processed. This enables users to write the code depending on if the PostBack is true or false (with the use of the function Page.IsPostBack()).
- Master pages:母版页
Master Page 使您有能力为 web 应用程序中的所有页面(或页面组)创建一致的外观和行为。
Master Page 为其他页面提供了模版,带有共享的布局和功能。Master Page 为内容定义了可被内容页面覆盖的占位符。而输出结果就是 Master Page 和内容页面的组合。
<%@ Master Language="C#" %> 定义了一个母版页; <%@ Page Language="C#" %> 定义正常的.aspx页面
- 文件类型
.aspx 默认的asp程序文件类型;
.ascx ASP的Web User control文件
.ashx ASP的Web handler文件
.asmx ASP的Webservices source file
Global.asax文件:
The Global.asax file, also known as the ASP.NET application file, is an optional file that contains code for responding to application-level and session-level events raised by ASP.NET or by HTTP modules. The Global.asax file resides in the root directory of an ASP.NET application. At run time, Global.asax is parsed and compiled into a dynamically generated .NET Framework class derived from the HttpApplication base class. ASP.NET is configured so that any direct URL request for the Global.asax file is automatically rejected; external users cannot download or view the code in it.
The Global.asax file is optional. You create it only if you want to handle application or session events.

Page_Load 事件会在页面加载时被触发

- 标识
<%@ ...%> 用来指定一些指令
<% ... %> 用来写c#代码
<%=value%> 用来输出value变量的值
<%# Eval("Field") %> 用来绑定字段 Field的值。
<%-- .... --%> 注释

 

 

实例代码:

Defaul.aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ASPTest._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
        <br />
        <asp:TextBox ID="TextBox1" runat="server" ontextchanged="TextBox1_TextChanged"></asp:TextBox>
    
    </div>
    <asp:Button ID="Button1" runat="server" Text="Click Me" 
        οnclick="Button1_Click" />
    </form>
</body>
</html>

 

用浏览器查看得到的代码:

Default.aspx:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



<html xmlns="http://www.w3.org/1999/xhtml" >

<head><title>

	Untitled Page

</title></head>

<body>

    <form name="form1" method="post" action="Default.aspx" id="form1">

<div>

<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTIxNDIyOTM0MmRkzVan0UUh62FKtqkn/2gEy5WcgoU=" />

</div>



<div>



	<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAwKDl6XsDQLs0bLrBgKM54rGBkqphEwcbuEriRcJGSWHH1L+6RpV" />



</div>

    <div>

    

        <span id="Label1">Label</span>

        <br />

        <input name="TextBox1" type="text" id="TextBox1" />

    

    </div>

    <input type="submit" name="Button1" value="Click Me" id="Button1" />

    </form>

</body>



</html>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值