ASP.NetÒ³Ã澲̬»¯
²½Ö裺
£±.¡¡Ð½¨Ò»¸öWEB½â¾ö·½°¸Ãû³ÆΪHtmlStatic¡£
£².¡¡ÔÚÏîĿϽ¨Ò»¸öHtmlTemp.htmÆä´úÂëÈçÏ£º
¡¡¡¡¡¡<!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>{Title}</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<table cellpadding="5" cellspacing="0" width="500" border="2">
<tr>
<td>ÁôÑÔÈË£º </td>
<td>{AddUserName} </td>
</tr>
<tr>
<td>ÁôÑÔÐÅÏ¢£º </td>
<td>{AddMsg}</td>
</tr>
<tr>
<td align="right" colspan="2">
ÁôÑÔÌí¼Óʱ¼ä£º{AddTime}
</td>
</tr>
</table>
</body>
</html>
£³.¡¡ÔÚÏîĿϽ¨Ò»¸öÃû×ÖΪHtmlµÄÎļþ¼Ð
£´.¡¡ÔÚÏîĿϽ¨Ò»¸öAddData.aspx ´úÂëÈçÏ£º
¡¡¡¡¡¡<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AddData.aspx.cs" Inherits="TestStatic.AddData" %>
<!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 id="Head1" runat="server">
<title>Ìí¼ÓÁôÑÔÊý¾Ý </title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td>ÁôÑÔÈË£º </td>
<td> <asp:TextBox runat="server" ID="UName"> </asp:TextBox>
<asp:RequiredFieldValidator runat="server" ID="vd1" ControlToValidate="UName" ErrorMessage="ÇëÊäÈëÁôÑÔÈË"> </asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<
Ïà¹ØÎĵµ£º
1.»ñÈ¡Return·µ»ØÖµ
³ÌÐò´úÂë//´æ´¢¹ý³Ì
//Create PROCEDURE MYSQL
// @a int,
// @b int
//AS
// return @a + @b
//GO
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["LocalSqlServer"].ToStri ......
ʲôÊÇMVCģʽ
MVC£¨Model-View-Controller£¬Ä£ÐÍ—ÊÓͼ—¿ØÖÆÆ÷ģʽ£©ÓÃÓÚ±íʾһÖÖÈí¼þ¼Ü¹¹Ä£Ê½¡£Ëü°ÑÈí¼þϵͳ·ÖΪÈý¸ö»ù±¾²¿·Ö£ºÄ£ÐÍ£¨Model£©£¬ÊÓͼ£¨View£©ºÍ¿ØÖÆÆ÷£¨Controller£©¡£
ÄÇôMVCģʽºÍÎÒÃÇÊìϤµÄWebFormģʽÓÐʲô²»Í¬ÄØ£¿ËûµÄ¸÷¸ö²¿·ÖÓÖÊÇÔõÑù·Ö¹¤µÄÄØ£¿
ÎÒÃÇÏÈÀ´¿´Ò»ÏÂÆÕͨµÄWebFormģʽÏ£ ......
ViewDataÓÐÒ»¸öModelStateµÄÊôÐÔ£¬ÕâÊÇÒ»¸öÀàÐÍΪModelStateDictionaryµÄModelStateÀàÐ͵Ä×ֵ伯ºÏ¡£ÔÚ½øÐÐÊý¾ÝÑéÖ¤µÄʱºòÕâ¸öÊôÐÔÊDZȽÏÓÐÓõġ£ÔÚʹÓÃHtml.ValidationMessage()µÄʱºò£¬¾ÍÊÇ´ÓViewData.ModelStateÖмì²âÊÇ·ñÓÐÖ¸¶¨µÄKEY£¬Èç¹û´æÔÚ£¬¾ÍÌáʾ´íÎóÐÅÏ¢¡£ÀýÈçÔÚǰһƪÎÄÕÂASP.NET MVC ÈëÃÅ7¡¢HellperÓëÊý¾ÝµÄÌá ......
¡¡¡¡Ê×Ïȼì²éWeb.configÎļþÀïÊÇ·ñÊÇÈçÏ´úÂ룺
¡¡¡¡´ò¿ªVS2005´´½¨ÐÂÏîÄ¿£¬Ñ¡ÔñASP.NET¡¡AJAXÏîÄ¿£¬È»ºó°Ñ¸ÃÏîÄ¿Web.configÎļþµÄÄÚÈÝÈ«²¿¸´ÖƵ½Ä㱨´íµÄWeb.configÎļþÀï¡£
¡¡¡¡Èç¹ûÕâ¸ö°ì·¨Î´Äܽâ¾ö°ì·¨Çë²é¿´¸ÃÏîÄ¿¸ùĿ¼µÄBinÎļþ¼ÐÄÚÊÇ·ñÓÐSystem.Web.Extensions.Design.dll¡¢System.Web.Extensions.dll¡¢A ......
ÔÚIIS6Éϲ¿Êð¹ýASP.Net MVCµÄÒ»¶¨ÖªµÀ£¬ÎªÁËÄÜÈÃIIS½«¶ÔASP.Net MVCµÄÇëÇóת·¢¸øASP.Net´¦Àí£¬±ØÐëÌí¼ÓÓ¦ÓóÌÐòISAPIÓ³Éä¡£ ±ÜÃâÕâÖÖÓ³ÉäÌí¼ÓµÄÒ»ÖÖ·½·¨ÊÇÀûÓÃÒÑÓеÄÓ³É䣬ÀýÈç.aspxÀ©Õ¹ÃûµÄÓ³Éä¡£²»¹ýÄÇÑùµÄ»°ASP.Net MVCµÄUrl»áºÜ¡°ÄÑ¿´¡±£¬¡°http://localhost/ASPNETMVCAPP/Account.aspx/Logon/¡±¡£Èç¹ûÄÜ°ÑÆäÖеÄ.a ......