asp.net±éÀú¿Ø¼þ
1¡¢ÔÚÒ³Ã涯̬Ìí¼ÓÒ»¸ö¿Ø¼þµÄ·½·¨¡£ ÔÚÒ³ÃæµÄ HTML ´úÂëÉÏÉèÖÃÒ»¸ö asp:PlaceHolder վλ¿Ø¼þ£¬µ±Ò³Ãæ±»¼ÓÔصÄʱºò£¬ÔÚÕâ¸ö PlaceHolder ¿Ø¼þÉÏÌí¼ÓËùÐèÒªµÄÆäËû¿Ø¼þ¡£
<asp:PlaceHolder runat="server" id="PutLabelHere" /> Sub Page_Load(sender as Object, e as EventArgs) sub Page_Load(sender as Object, e as EventArgs) Dim lblMessage as New Label() lblMessage.Text = "Hello, World!" lblMessage.Font.Bold = True PutLabelHere.Controls.Add(lblMessage) end sub End Sub
2¡¢±éÀú¿Ø¼þµÄ·½·¨¡£ Ò³Ãæ¿ÉÒÔ±»¿´³É¸÷Öֿؼþ×é³ÉµÄÒ»¸ö¼¯ºÏ¡£ÔÚÒ³Ãæ±»³õʼ»¯ºÍ¼ÓÔعý³ÌÖУ¬¿ÉÒÔ±éÀúÕâЩ¿Ø¼þ£¬ÕÒµ½Ìض¨µÄ¿Ø¼þ£¬»òÕ߸ıäijЩ¿Ø¼þµÄÊôÐÔ¡£ ÏÈ¿´ÏÂÃæµÄÒ»¸öÀý×Ó£º
script runat="server" language="C#"> void Page_Load(Object sender, EventArgs e) { foreach(Control c in Controls) lblControlList.Text += c.ToString() + " - " + c.ID + "<br>"; } </script> <html> <head> </head> <body> <b>A List of the Controls in the <code>Controls</code> Collection</b><br> <asp:label runat="server" id="lblControlList" /> <p> <form runat="server"> What's your name? <asp:textbox runat="Server" id="txtName" /> </form> </body> </html>
Õâ¸öÀý×ÓÁгöÒ³ÃæÉÏËùÓеĿؼþ,½á¹ûÈçÏ£º
Ïà¹ØÎĵµ£º
ÔÚGlobal.asaxÆô¶¯Ò»ÌõÏ߳̾ÍokÁË£¬ÏÂÃæÊÇÆô¶¯Ï̶߳¨Ê±Ð´ÎļþµÄÀý×Ó
¡¡¡¡Global.asax
¡¡¡¡C# code
¡¡¡¡Code
¡¡¡¡1<%@ Application Language="C#" %>
¡¡¡¡2<%@ Import Namespace="System.IO" %>
¡¡¡¡3<%@ Import Namespace="System.Threading" %>
¡¡¡¡4<script runat="server">
¡¡¡¡5 ......
ASP.net¿Ø¼þ·ÖÀࣺ
1¡¢HTML¿Ø¼þ System.Web.UI.Htmlcontrols
ÆÕͨHTML½Å±¾¿Ø¼þ£¬ÊôÓÚ¿Í»§¶Ë¿Ø¼þ£¬ÓÃÓÚ¿Í»§¶Ë½âÊÍÒ³ÃæµÄÏÔʾµÄÄÚÈÝ
Ò²¿ÉÒÔת»¯³É·þÎñÆ÷¿Ø¼þ£¬Ö»ÐèÒª¼ÓÉÏÊôÐÔ runat="server"
È磺Îı¾¿òÅäºÏ°´Å¥Ê¹ÓÃ
ÐÕÃû: <input id="txtUserName" name="txtUserName" type="text" /&g ......
1. BinÎļþ¼Ð
BinÎļþ¼Ð°üº¬Ó¦ÓóÌÐòËùÐèµÄ£¬ÓÃÓڿؼþ¡¢×é¼þ»òÕßÐèÒªÒýÓõÄÈκÎÆäËû´úÂëµÄ¿É²¿Êð³ÌÐò¼¯¡£¸ÃĿ¼ÖдæÔÚµÄÈκÎ.dllÎÄ ¼þ½«×Ô¶¯µØÁ´½Óµ½Ó¦ÓóÌÐò¡£
2. App_BrowserÎļþ¼Ð
¸Ã¿ÉÑ¡µÄÎļþ¼Ð°üº¬.browserÎļþ¡£.browserÎļþÃèÊöä¯ÀÀÆ÷(²»¹ÜÊÇÒƶ¯É豸ä¯ÀÀÆ÷£¬»¹ÊÇ̨ʽ»úä¯ÀÀÆ÷)µÄÌØ Õ÷ºÍ¹¦ÄÜ¡£
3. ......
ʹÓà SqlDataSource ¿Ø¼þÖ»ÐèºÜÉٵĴúÂë»òÎÞÐèÈκδúÂë¼´¿É´ÓÊý¾Ý¿âÖмìË÷Êý¾Ý¡£SqlDataSource ¿Ø¼þ¿ÉÓÃÓÚÈκξßÓйØÁª ADO.NET Ìṩ³ÌÐò£¨ÔÚÅäÖÃÎļþµÄ DbProviderFactories ½ÚÖÐÅäÖ㩵ÄÊý¾Ý¿â£¬°üÀ¨ Microsoft SQL Server¡¢Oracle¡¢ODBC »ò OLE DB Êý¾Ý¿â£¨Èç Microsoft Access£©¡£ÄúÔÚÅäÖÃʱָ¶¨ SqlDataSource ʹÓõ ......