ASP.NET MVC½éÉÜ
The Model-View-Controller (MVC) architectural pattern separates an application into three main components: the model, the view, and the controller. The ASP.NET MVC framework provides an alternative to the ASP.NET Web Forms pattern for creating MVC-based Web applications. The ASP.NET MVC framework is a lightweight, highly testable presentation framework that (as with Web Forms-based applications) is integrated with existing ASP.NET features, such as master pages and membership-based authentication. The MVC framework is defined in the System.Web.Mvc namespace and is a fundamental, supported part of the System.Web namespace. MVC is a standard design pattern that many developers are familiar with. Some types of Web applications will benefit from the MVC framework. Others will continue to use the traditional ASP.NET application pattern that is based on Web Forms and postbacks. Other types of Web applications will combine the two approaches; neither approach excludes the other. MVC¼Ü¹¹Ä£Ê½½«Ó¦ÓóÌÐò·ÖΪģÐÍ-ÊÓͼ-¿ØÖÆÆ÷Èý¸öÖ÷Òª×éÖ¯²¿·Ö£¬ASP.NET MVC¿ò¼ÜÌṩһÖÖ¿ÉÒÔ´úÌæASP.NET Web FormsģʽÀ´´´½¨»ùÓÚMVCµÄÓ¦ÓóÌÐò£¬ASP.NET MVCÊÇÇáÁ¿¼¶µÄ£¬¸ß¿É²âÊԵĿò¼Ü£¬²¢ÇÒ¿ÉÒÔ½áºÏÏÖÓеÄASP.NETµÄÌØÐÔÈçĸ°å¡¢»ùÓÚmembershipµÄÉí·ÝÑéÖ¤£¬MVC¿ò¼Ü»ù´¡¶¨ÒåÔÚSystem.Web.MvcÃüÃû¿Õ¼äÖе쬳ÉΪSystem.WebÃüÃû¿Õ¼äµÄÒ»²¿·Ö¡£ MVC×÷Ϊһ¸ö±ê×¼µÄÉè¼ÆÄ£Ê½±»¹ã´óµÄ¿ª·¢ÈËÔ±ËùÊìÖª¡£Ä³Ð©ÀàÐ͵ÄWebÓ¦ÓóÌÐò½«ÊÜÒæÓÚMVC framework¡£ÆäËüÀàÐ͵ÄÓ¦ÓóÌÐò¿ÉÒÔ¼ÌÐøÊ¹Óô«Í³µÄ»ùÓÚPostbacksµÄWeb formsģʽ½øÐÐASP.NET¿ª·¢£¬Ò²¿ÉÒÔ½áºÏÕâÁ½ÖÖģʽ£¬ËüÃÇÊDz¢ÐдæÔÚ¶ø²»ÊÇ»¥Ïà³åÍ»µÄ¡£ The MVC framework includes the following components: MVC¿ò¼Ü°üº¬ÈçÏÂ×é³É²¿·Ö£º Models. Model objects are the parts of the application that implement the logic for the application's data domain. Often, model objects retrieve and store model state in a database. For example, a Product object might retrieve information from a database, operate on it, and then write updated information back to a Products table in SQL Server. In small applications, the mo
Ïà¹ØÎĵµ£º
Introduction
In this article, we will take a closer look at how ASP.NET pages post back to themselves, and how to customize this feature in our web applications.
function __doPostBack(eventTarget, eventArgument)
One of the most important features of the ASP.NET environment is the ability to decla ......
a.aspx
//ÏÔʾij¸ö¶©µ¥µÄÏêϸÐÅÏ¢£¬Í¨¹ýÒ»¸öģ̬¶Ô»°¿ò£¬¶øÇÒÆÁÄ»»á±äÑÕÉ«
function ShowOrderDetails(orderId) {
var url = "AddMenu.aspx?ID=" + orderId;
&n ......
ASP.NET ÅäÖýڼܹ¹°üº¬¿ØÖÆ ASP.NET Web Ó¦ÓóÌÐòÐÐΪµÄÔªËØ¡£Èç¹ûΪÊôÐÔÖ¸¶¨ÁËĬÈÏÖµ£¬Ôò¸ÃĬÈÏÖµÊÇÔÚ Machine.config ÎļþÖÐÉèÖõ쬏ÃÎļþµÄ·¾¶ÊÇ systemroot\Microsoft.NET\Framework\versionNumber\CONFIG\Machine.config¡£
<configuration>
<location>
......
substring
public String substring(int beginIndex)·µ»ØÒ»¸öеÄ×Ö·û´®£¬ËüÊÇ´Ë×Ö·û´®µÄÒ»¸ö×Ó×Ö·û´®¡£¸Ã×Ó×Ö·û´®Ê¼ÓÚÖ¸¶¨Ë÷Òý´¦µÄ×Ö·û£¬Ò»Ö±µ½´Ë×Ö·û´®Ä©Î²¡£
ÀýÈ磺
"unhappy".substring(2) returns "happy"
"Harbison".substring(3) returns "bison"
"emptiness".substring(9) returns "" (an empty string)
² ......
ÈÕÆÚת»¯Ò»
ΪÁË´ïµ½²»Í¬µÄÏÔʾЧ¹ûÓÐʱ£¬ÎÒÃÇÐèÒª¶Ôʱ¼ä½øÐÐת»¯£¬Ä¬ÈϸñʽΪ£º2007-01-03 14:33:34 £¬Òª×ª»¯ÎªÆäËû¸ñʽ£¬ÒªÓõ½DateTime.ToStringµÄ·½·¨(String, IFormatProvider)£¬ÈçÏÂËùʾ£º
using System;
using System.Globalization;
String format="D";
DateTime date=DataTime,Now;
Response.Write(date.ToS ......