ASP.NET(ASPX)Ò³Ãæ»ñÈ¡form±íµ¥Ìá½»ÔªËØµÄÖµ
html֪ʶ£¬Request.Form
½ÓÊÕµÄÊÇNameÖµ£¬¶ø·ÇIDÖµ
ÈôÊÇÓÃaspxÒ³ÃæÈ¡Öµ£¬±íµ¥ÖеÄrunat="server"Ҫȥµô¡£
asp.net֪ʶ£¬asp.netµÄ¿Ø¼þµÄIDºÍNameÖµÊÇÒ»ÑùµÚ£¬µ«ÊÇÆäÔÚ¿Í»§¶Ë±íÏÖÊÇcontrol.clientID¶ø·Ç
control.ID
asp.net±¾ÉíÒ²ÊÇ¿ÉÒÔ¿çÒ³Ìá½»µÎ£¬Èç¹ûÊÇʹÓÃ×Ô¼º´øµÄ¿çÒ³Ìá½»¾Í²»´æÔÚÉÏÊöÎÊÌ⣬²»¹ýasp.net×Ô¼º´øµÄ¿çÒ³Ìá½»ÓÐÁíÍâµÄ½Ó
ÊÕ·½Ê½
ʵÀý
<!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>
</head>
<body>
<form id="formPost" action="Default.aspx" method="post">
<div>
<input name="txtPostValue" type="text" />
<input type="submit" /><br />
<br />
<br />
<br />
<input name="filePic" type="file" /></div>
</form>
</body>
</html>
<%@ Page Language="C#"
AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_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>ÎÞ±êÌ
Ïà¹ØÎĵµ£º
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Syste ......
1. C#ÓïÑÔ·½Ãæ
1.1 À¬»ø»ØÊÕ
¡¡À¬»ø»ØÊÕ½â·ÅÁËÊÖ¹¤¹ÜÀí¶ÔÏóµÄ¹¤×÷£¬Ìá¸ßÁ˳ÌÐòµÄ½¡×³ÐÔ£¬µ«¸±×÷ÓþÍÊdzÌÐò´úÂë¿ÉÄܶÔÓÚ¶ÔÏó´´½¨±äµÃËæÒâ¡£
¡¡1.1.1 ±ÜÃâ²»±ØÒªµÄ¶ÔÏó´´½¨
¡¡ÓÉÓÚÀ¬»ø»ØÊյĴú¼Û½Ï¸ß£¬ËùÒÔC#³ÌÐò¿ª·¢Òª×ñѵÄÒ»¸ö»ù±¾ÔÔò¾ÍÊDZÜÃâ²»±ØÒªµÄ¶ÔÏó´´½¨¡£ÒÔÏÂÁоÙһЩ³£¼ûµÄÇéÐΡ£
¡¡1.1.1.1 ±ÜÃâÑ»·´´½¨¶ÔÏ ......
asp.net´íÎó´¦Àí·½·¨ ´ó²¿·Ö¶¼Óà try catch
ÎÒÃÇÒ²¿ÉÒÔÔÚÒ³Ãæ¶¨Òå protected void Page_Error(object sender, EventArgs e)·½·¨´¦Àí´íÎóÐÅÏ¢
{
//ÏÈ»ñÈ¡µ±Ç°·¢ÉúÒì³£
Exception ex = Server.GetLastError().GetBaseException();
if (ex is ArgumentOu ......
ʵÏÖÒ³Ãæ»»·ô ¸øhtml form Ìí¼ÓÏàÓ¦µÄÑùʽ ´úÂëÈçÏÂ:
private string _StyleClass;
public string StyleClass
{
get { return _StyleClass; }
set { _StyleClass = value; }
}
private void StyleForm()
{
HtmlForm Form1 = this.FindControl("form1") a ......
ÏÈ¿´ÏÂÃæµÄÒ»¶Î´úÂ룺
public class UserTest
{
public int age { set; get;
}
¡¡¡¡¡¡¡¡ public string name { set; get; } & ......