Asp.net±ØÐëÕÆÎÕµÄһЩ¶«Î÷
1.ÃæÏò¶ÔÏóµÄ˼ÏëÖ÷Òª°üÀ¨Ê²Ã´£¿
¼Ì³Ð¶à̬·â×°
¡ñ·â×°£ºÓóéÏóµÄÊý¾ÝÀàÐͽ«Êý¾ÝºÍ»ùÓÚÊý¾ÝµÄ²Ù×÷·â×°ÔÚÒ»Æð£¬Êý¾Ý±»±£»¤ÔÚ³éÏóÊý¾ÝÀàÐÍÄÚ²¿¡£
¡ñ¼Ì³Ð£º×ÓÀàÓµÓи¸ÀàµÄËùÓÐÊý¾ÝºÍ²Ù×÷¡£
¡ñ¶à̬£ºÒ»¸ö³ÌÐòÖÐͬÃûµÄ²»Í¬·½·¨¹²´æµÄÇé¿ö¡£
ÓÐÁ½ÖÖÐÎʽµÄ¶à̬–ÖØÔØÓëÖØÐ´¡£
2.ʲôÊÇASP.netÖеÄÓû§¿Ø¼þ
Óû§¿Ø¼þ¾ÍÊÇ.ascxÀ©Õ¹ÃûµÄ¶«Î÷à¶,¿ÉÒÔÍϵ½²»Í¬µÄÒ³ÃæÖе÷ÓÃ,ÒÔ½ÚÊ¡´úÂë.±ÈÈçµÇ½¿ÉÄÜÔÚ¶à¸öÒ³ÃæÉÏÓÐ,¾Í¿ÉÒÔ×ö³ÉÓû§¿Ø¼þ,µ«ÊÇÓÐÒ»¸öÎÊÌâ¾ÍÊÇÓû§¿Ø¼þÍϵ½²»Í¬¼¶±ðµÄĿ¼ÏºóÀïÃæµÄͼƬµÈµÄÏà¶Ô·¾¶»á±äµÃ²»×¼È·,ÐèÒª×ÔÒÑд·½·¨µ÷Õû.
ÎÊÕâÑùµÄÎÊÌâ,Ò»°ãÊÇÃÔ»óÄã.ÒòΪÐÂÊÖ»¹ÊÇ·Ö²»Çå³þÓû§¿Ø¼þºÍ·þÎñÆ÷¿Ø¼þ(Ò²³Æ×Ô¶¨Òå¿Ø¼þ)..Óû§¿Ø¼þÒ»°ãÓÃÔÚÄÚÈݶàΪ¾²Ì¬,»òÕßÉÙÐí»á¸Ä±äµÄÇé¿öÏÂ..ÓõıȽϴó..ÀàËÆASPÖеÄinclude..µ«Êǹ¦ÄÜҪǿ´óµÄ¶à..
ÔÚC££ÖУ¬string str = null Óë string str = “”µÄÇø±ð¡£
´ð£ºstring str = null ÊDz»¸øËû·ÖÅäÄÚ´æ¿Õ¼ä,¶østring str = "" ¸øËü·ÖÅ䳤¶ÈΪ¿Õ×Ö·û´®µÄÄÚ´æ¿Õ¼ä
ÇëÏêÊöÔÚdotnetÖÐÀà(class)Óë½á¹¹(struct)µÄÒìͬ
Class¿ÉÒÔ±»ÊµÀý»¯,ÊôÓÚÒýÓÃÀàÐÍ,ÊÇ·ÖÅäÔÚÄÚ´æµÄ¶ÑÉϵÄ,StructÊôÓÚÖµÀàÐÍ,ÊÇ·ÖÅäÔÚÄÚ´æµÄÕ»ÉϵÄ.
DataReaderºÍDataSetµÄÒìͬ
DataReaderºÍDataSet×î´óµÄÇø±ðÔÚÓÚ,DataReaderʹÓÃʱʼÖÕÕ¼ÓÃSqlConnection,ÔÚÏß²Ù×÷Êý¾Ý¿â..ÈκζÔSqlConnectionµÄ²Ù×÷¶¼»áÒý·¢DataReaderµÄÒì³£..ÒòΪDataReaderÿ´ÎÖ»ÔÚÄÚ´æÖмÓÔØÒ»ÌõÊý¾Ý,ËùÒÔÕ¼ÓõÄÄÚ´æÊǺÜСµÄ..ÒòΪDataReaderµÄÌØÊâÐԺ͸ßÐÔÄÜ.ËùÒÔDataReaderÊÇÖ»½øµÄ..Äã¶ÁÁ˵ÚÒ»Ìõºó¾Í²»ÄÜÔÙÈ¥¶ÁÈ¡µÚÒ»ÌõÁË..
DataSetÔòÊǽ«Êý¾ÝÒ»´ÎÐÔ¼ÓÔØÔÚÄÚ´æÖÐ.ÅׯúÊý¾Ý¿âÁ¬½Ó..¶ÁÈ¡Íê±Ï¼´·ÅÆúÊý¾Ý¿âÁ¬½Ó..ÒòΪDataSet½«Êý¾ÝÈ«²¿¼ÓÔØÔÚÄÚ´æÖÐ.ËùÒԱȽÏÏûºÄÄÚ´æ...µ«ÊÇÈ·±ÈDataReaderÒªÁé»î..¿ÉÒÔ¶¯Ì¬µÄÌí¼ÓÐÐ,ÁÐ,Êý¾Ý.¶ÔÊý¾Ý¿â½øÐлش«¸üвÙ×÷.
8.C#ÖеĽӿںÍÀàÓÐʲôÒìͬ¡£
½Ó¿ÚºÍÀà¶¼ÊÇÀ࣬²»Í¬µÄÊ£¬½Ó¿ÚÖ»°üº¬·½·¨»òÊôÐÔµÄÉùÃ÷£¬²»°üº¬¾ßÌåʵÏÖ·½·¨µÄ´úÂ룬½Ó¿Ú¿ÉÒÔʵÏÖ¶à¼Ì³Ð£¬¶øÀàÖ»ÄÜÊǵ¥¼Ì³Ð£¬¼Ì³Ð½Ó¿ÚµÄÀà±ØÐëʵÏÖ½Ó¿ÚÖÐÉùÃ÷µÄ·½·¨»òÊôÐÔ¡£½Ó¿ÚÖ÷Òª¶¨ÒåÒ»Öֹ淶£¬Í³Ò»µ÷Ó÷½·¨£¬ÔÚ´óÐÍÏîÄ¿ÖнӿÚÕý·¢»ÓÈÕÒæÖØÒªµÄ×÷ÓÃ
ÀàÊÇ·½·¨¹¦ÄܵÄʵÏֺͼ¯ºÏ,½Ó¿ÚÊǹ淶Àà.Ô¼ÊøÀà.
½Ó¿Ú,ÊÇ¿ÉÒÔ¶à¼Ì³Ð,ÀàÖ»Óе¥¼Ì³Ð.½Ó¿ÚÇ¿µ÷ÁËÄã±ØÐëʵÏÖ,¶øÃ»Óо߱¾ÊµÏֵķ½·¨ºÍÐéÀàÓеãÏàËÆ
OverrideÓëÖØÔØÓÐÊ²Ã´Çø±ð£¿
Ò»¸öÊÇÖØÐ´¸¸ÀຯÊý£¬Ò»¸öÊÇͬһ¸öº¯ÊýµÄ
Ïà¹ØÎĵµ£º
µÚÒ»ÖÖ·½·¨£º
ͨ¹ýURLÁ´½ÓµØÖ·´«µÝ
send.aspx:
protected void Button1_Click(object sender, EventArgs e)
{
Request.Redirect("Default2.aspx?username=honge");
}
receive.aspx:
string user ......
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 ......
×î½üÅöµ½Ò»ÎÊÌ⣬ÐèÒªÔÚASP.NetºÍJavaScriptÖд«µÝÊý¾Ý¡£¾ßÌåµÄÐèÇóÊÇÕâÑùµÄ£¬Ò³Ãæpostbackºó½«»áload JS£¬µ«ÊÇÐèÒª¼Çס֮ǰij¸ö״̬£¬Õâ¸ö״̬ÊÇÖ¸JSµÄ״̬£¬Ò²¾ÍÊÇ˵load JSºó£¬»¹Òª¼Çס֮ǰµÄ״̬£¬¶ø²»Êǻص½Ä¬ÈϵÄ״̬¡£
Ò»¿ªÊ¼ÏëÁ˺ܶà°ì·¨£¬µ«¶¼²»³É¹¦£¬ºóÀ´ÎÊÁËÎÊͬÊ£¬·¢ÏÖ¿ÉÒÔͨ¹ýÒþ²ØµÄ±íµ¥ÔªËØÀ´´«µÝÊý¾Ý£¬ËùÒ ......
public class PageBase:System.Web.UI.Page
{
public PageBase()
{
//
// TODO: Add constructor logic here
//
}
protected override void InitializeCulture()
{
// ......