Asp.Netǰ̨µ÷Óúǫ́±äÁ¿
1. Asp.NetÖм¸ÖÖÏàËƵıê¼Ç·ûºÅ: < %=...%>< %#... %>< % %>< %@ %>½âÊͼ°Ó÷¨
´ð: < %#... %>: ÊÇÔڰ󶨿ؼþDataBind()·½·¨Ö´ÐÐʱ±»Ö´ÐУ¬ÓÃÓÚÊý¾Ý°ó¶¨
Èç: < %# Container.DataItem("tit") %>
< %= %>: ÔÚ³ÌÐòÖ´ÐÐʱ±»µ÷Ó㬿ÉÒÔÏÔʾºǫ́±äÁ¿Öµ
Èç:
*.aspxÖУº < %= aaa %>
*.csÖÐ: protected string aaa="ÐÕÃû";
< % %>: ÄÚÁª´úÂë¿éÀïÃæ¿ÉÒÔÔÚÒ³ÃæÎļþ*.aspx»ò*.ascxÎļþÀïÃæǶÈëºǫ́´úÂë
Èç:
< %
for(int i=0;i<100;i++)
{
Reaponse.Write(i.ToString());
}
%>
< %@ %>ÊÇÔÚ*.aspxÒ³Ãæǰ̨´úÂëµ¼ÈëÃüÃû¿Õ¼ä,
Èç:
< %@ Import namespace="System.Data"%>
2.¿Ø¼þ½ÓÊÕÄÄЩÀàÐÍÊý¾Ý?
´ð:½ÓÊÕBindµÄ¿Ø¼þ£¬Ò»°ãÓÐDropDownList,DataList,DataGrid,ListBoxÕâЩ¼¯ºÏÐÔÖʵĿؼþ£¬¶ø±»À¦°ó µÄÖ÷ÒªÊÇArrayList(Êý×é),Hashtable(¹þÏ¡±í),DataView(Êý¾ÝÊÓͼ),DataReaderÕâËĸö£¬ÒÔºóÎÒÃǾͿÉÒÔ ¶ÔºÅÈë×ù£¬²»»á³öÏÖDataTable±»À¦°óµÄ´íÎóÁË£º£©
3.DataBind,»ñµÃµÄÊý¾Ý£¬ÏµÍ³»á½«ÆäĬÈÏΪString,ÔõÑùת»¯ÎªÆäËüµÄÀàÐÍ?
DataBinder.Eval(Container.DataItem,"ת»»µÄÀàÐÍ","¸ñʽ")
×îºóÒ»¸ö"¸ñʽ"ÊÇ¿ÉÑ¡µÄ£¬Ò»°ã²»ÓÃÈ¥¹ÜËû£¬Container.DataItemÊÇÀ¦°óµÄÊý¾ÝÏî,"ת»»ÀàÐÍ"Ö¸µÄÊÇ Integer,String,BooleanÕâÒ»ÀණÎ÷.
4.Ö÷ÒªÃüÃû¿Õ¼ä:
< % @ Import Namespace="System.Data" %> ´¦ÀíÊý¾ÝʱÓõ½
< % @ Import Namespace="System.Data.ADO" % > ʹÓÃADO.net ; ʱÓõ½
< % @ Import Namespace="System.Data.SQL" %> SQL Server Êý¾Ý¿âרÓÃ
< % @ Import Namespace="System.Data.XML" %> ²»Óÿ´´¦ÀíXMLÓõ½
< % @ Import Namespace="System.IO" %> ´¦ÀíÎļþʱÓõ½
< % @ Import Namespace="System.Web.Util" %> ·¢Óʼþʱ´ó¼Ò»áÓõ½
< % @ Import Namespace="System.Text" %> Îı¾±àÂëʱÓõ½
5.Connections(SQLConection »òÕß ADOConnection)µÄ³£ÓÃÊôÐԺͷ½·¨:
| ConnectionString È¡µÃ»òÉèÖÃÁ¬½áÊý¾Ý¿âµÄÓï¾ä
| ConnectionTimeout È¡µÃ»òÉèÖÃÁ¬½áÊý¾Ý¿âµÄ×ʱ¼ä£¬Ò²ÊǾͳ¬Ê±Ê±¼ä
| DataBase È¡µÃ»òÉèÖÃÔÚÊý¾Ý¿â·þÎñÆ÷ÉÏÒª´ò¿ªµÄÊý¾Ý¿âÃû
| DataSource È¡µÃ»òÉèÖÃDSN,´ó¼Ò²»»áÄ°Éú°É£º£©
| Password È¡µÃ»òÉèÖÃÃÜÂë
| UserID È¡µÃ»òÉèÖõǽÃû
| State È¡µÃÄ¿Ç°
Ïà¹ØÎĵµ£º
ÔÚASP.NET 2.0 WEÕ¾µãÉÏ£¬ÎÒÃÇ¿ÉÒÔͨ¹ýÔÚweb.configÎļþÖмÓÈëÏÂÃæµÄ½ÚµãÀ´Ö§³ÖÌõ¼þ±àÒë¡£
<compilers>
<compiler language="c#" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"
¡¡¡¡extension ......
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
/// <summary>
/// Pub µÄժҪ˵Ã÷
/// </summa ......
AJAX¼¼ÊõËùÌᳫµÄÎÞˢлص÷£¬ÔÚÔÀ´µÄ¼¼ÊõÖÐÐèҪд´óÁ¿µÄJavaScript´úÂë»òʹÓÃһЩAJAX¿ò¼Ü£¬Ê¹µÃ¿ª·¢Ð§ÂʺͿÉά»¤ÐÔ´ó´ó½µµÍ¡£ÆäʵASP.NET2.0ÖУ¬ÒѾÌṩÁËÕâÑùµÄ½Ó¿Ú£¬Õâ¾ÍÊÇICallbackEventHandler¡£
ICallbackEventHandler´æÔÚÓÚSystem.Web.UIÖУ¬ÎÒÃÇÏÈ×öÒ»¸ö·Ç³£¼òµ¥µÄÀý×ÓÀ´ÊÔÓÃһϡ£
¡¡¡¡ µÚÒ»²½£¬ÔÚVS2005Öн¨ ......
1 Ä¿µÄ
2 ·¶Î§
3 ×¢Ê͹淶
3.1 ¸ÅÊö
3.2 ×Ô½¨´úÂëÎļþ×¢ÊÍ
3.3 Ä£¿é£¨ÀࣩעÊÍ
3.4 ÀàÊôÐÔ×¢ÊÍ
3.5 ·½·¨×¢ÊÍ
3.6 ´úÂë¼ä×¢ÊÍ
4   ......
ÔÚ.Netƽ̨ϽøÐÐCSÈí¼þ¿ª·¢Ê±,ÎÒÃǾ³£Óöµ½ÒÔºó»¹ÒªÓõ½Ä³Ð©±äÁ¿ÉÏ´ÎÐ޸ĺóµÄÖµ,ΪÁ˼òµ¥Æð¼û,ºÜ¶àÈ˶¼Ï°¹ßÓÃstaticÀ´¶¨ÒåÕâЩ±äÁ¿,ÎÒÒ²ÊÇ¡£ÕâÑù·Ç³£·½±ã£¬ÏÂÒ»´Îµ÷ÓÃij¸öº¯Êýʱ¸Ã±äÁ¿ÈÔÈ»±£´æµÄÊÇ´¦Àí¹ýµÄÖµ£¬Ö±½ÓÄÃÀ´ÓþͿÉÒÔÁË¡£
ÏÖÔÚתÈëÁËBSÈí¼þ¿ª·¢£¬ÎÒÃǺÜ×ÔÈ»µØ»áÑØÓ ......