asp.netÐÔÄÜÓÅ»¯µÄ¼¸¸ö·½Ãæ
c#£¨»òvb.net£©³ÌÐò¸Ä½ø
1¡¢Ê¹ÓÃÖµÀàÐ͵ÄToString·½·¨
¡¡¡¡ÔÚÁ¬½Ó×Ö·û´®Ê±£¬¾³£Ê¹ÓÃ"+"ºÅÖ±½Ó½«Êý×ÖÌí¼Óµ½×Ö·û´®ÖС£ÕâÖÖ·½·¨ËäÈ»¼òµ¥£¬Ò²¿ÉÒԵõ½ÕýÈ·½á¹û£¬µ«ÊÇÓÉÓÚÉæ¼°µ½²»Í¬µÄÊý¾ÝÀàÐÍ£¬Êý×ÖÐèҪͨ¹ý×°Ïä²Ù×÷ת»¯ÎªÒýÓÃÀàÐͲſÉÒÔÌí¼Óµ½×Ö·û´®ÖС£µ«ÊÇ×°Ïä²Ù×÷¶ÔÐÔÄÜÓ°Ïì½Ï´ó£¬ÒòΪÔÚ½øÐÐÕâÀà´¦Àíʱ£¬½«ÔÚÍйܶÑÖзÖÅäÒ»¸öеĶÔÏó£¬ÔÓеÄÖµ¸´ÖƵ½Ð´´½¨µÄ¶ÔÏóÖС£
¡¡¡¡Ê¹ÓÃÖµÀàÐ͵ÄToString·½·¨¿ÉÒÔ±ÜÃâ×°Ïä²Ù×÷£¬´Ó¶øÌá¸ßÓ¦ÓóÌÐòÐÔÄÜ¡£
int num=1;
string str="go"+num.ToString();
2¡¢ÔËÓÃStringBuilderÀà
¡¡¡¡StringÀà¶ÔÏóÊDz»¿É¸Ä±äµÄ£¬¶ÔÓÚString¶ÔÏóµÄÖØи³ÖµÔÚ±¾ÖÊÉÏÊÇÖØд´½¨ÁËÒ»¸öString¶ÔÏó²¢½«ÐÂÖµ¸³Óè¸Ã¶ÔÏó£¬Æä·½·¨ToString¶ÔÐÔÄܵÄÌá¸ß²¢·ÇºÜÏÔÖø¡£
¡¡¡¡ÔÚ´¦Àí×Ö·û´®Ê±£¬×îºÃʹÓÃStringBuilderÀ࣬Æä.NET ÃüÃû¿Õ¼äÊÇSystem.Text¡£¸ÃÀಢ·Ç´´½¨ÐµĶÔÏ󣬶øÊÇͨ¹ýAppend£¬Remove£¬InsertµÈ·½·¨Ö±½Ó¶Ô×Ö·û´®½øÐвÙ×÷£¬Í¨¹ýToString·½·¨·µ»Ø²Ù×÷½á¹û¡£
¡¡¡¡Æ䶨Òå¼°²Ù×÷Óï¾äÈçÏÂËùʾ£º
int num;
System.Text.StringBuilder str = new System.Text.StringBuilder(); //´´½¨×Ö·û´®
str.Append(num.ToString()); //Ìí¼ÓÊýÖµnum
Response.Write(str.ToString); //ÏÔʾ²Ù×÷½á¹û
3¡¢Ê¹Óà HttpServerUtility.Transfer ·½·¨ÔÚͬһӦÓóÌÐòµÄÒ³Ãæ¼äÖض¨Ïò
¡¡¡¡²ÉÓà Server.Transfer Óï·¨£¬ÔÚÒ³ÃæÖÐʹÓø÷½·¨¿É±ÜÃâ²»±ØÒªµÄ¿Í»§¶ËÖض¨Ïò£¨Response.Redirect£©¡£
4¡¢±ÜÃâʹÓÃArrayList¡£
ÒòΪÈκζÔÏóÌí¼Óµ½ArrayList¶¼Òª·âÏäΪSystem.ObjectÀàÐÍ£¬´ÓArrayListÈ¡³öÊý¾Ýʱ£¬Òª²ðÏä»Øʵ¼ÊµÄÀàÐÍ¡£½¨ÒéʹÓÃ×Ô¶¨ÒåµÄ¼¯ºÏÀàÐÍ´úÌæArrayList¡£asp.net 2.0ÌṩÁËÒ»¸öеÄÀàÐÍ£¬½Ð·ºÐÍ£¬ÕâÊÇÒ»¸öÇ¿ÀàÐÍ£¬Ê¹Ó÷ºÐͼ¯ºÏ¾Í¿ÉÒÔ±ÜÃâÁË·âÏäºÍ²ðÏäµÄ·¢Éú£¬Ìá¸ßÁËÐÔÄÜ¡£
5¡¢Ê¹ÓÃHashTale´úÌæÆäËû×ֵ伯ºÏÀàÐÍ
£¨ÈçStringDictionary,NameValueCollection,HybridCollection£©£¬´æ·ÅÉÙÁ¿Êý¾ÝµÄʱºò¿ÉÒÔʹÓÃHashTable.
6¡¢Îª×Ö·û´®ÈÝÆ÷ÉùÃ÷³£Á¿£¬²»ÒªÖ±½Ó°Ñ×Ö·û·â×°ÔÚË«ÒýºÅ" "ÀïÃæ¡£
//±ÜÃâ
MyObject obj = new MyObject();
obj.Status = "ACTIVE";
//ÍƼö
const string C_STATUS = "ACTIVE";
MyObject obj = new MyObject();
obj.Status = C_STATUS;
7¡¢²»ÒªÓÃToUpper(),ToLower()ת»»×Ö·û´®½øÐбȽϣ¬ÓÃString.Compare´úÌ棬Ëü¿ÉÒÔºöÂÔ´óСд½øÐбȽÏ.
Àý£º
const string C_VALUE = "COMPARE"
Ïà¹ØÎĵµ£º
Èç¹û¶Ô΢ÐͼÆËã»úÓ²¼þϵͳÓÐ×ã¹»µÄÁ˽⣬ÄÇôÎÒÃǶÔÓÚCacheÕâ¸öÃû´ÊÒ»¶¨ÊǶúÊìÄÜÏêµÄ¡£ÔÚCPUÒÔ¼°Ö÷°åµÄоƬÖУ¬¶¼ÒýÈëÁËÕâÖÖÃûΪ¸ßËÙ»º³å´æ´¢Æ÷£¨Cache£©µÄ¼¼Êõ¡£ÒòΪCacheµÄ´æÈ¡ËٶȱÈÄÚ´æ¿ì£¬Òò¶øÒýÈëCacheÄܹ»ÓÐЧµÄ½â¾öCPUÓëÄÚ´æÖ®¼äµÄËٶȲ»Æ¥ÅäÎÊÌâ¡£Ó²¼þϵͳ¿ÉÒÔÀûÓÃCache´æ´¢CPU·ÃÎʸÅÂʸߵÄÄÇЩÊý¾Ý£¬µ±CPUÐèÒª· ......
ÔÚ±¾ÑÝÁ·ÖУ¬½«Ê¹ÓÃÈý¸ö ASP.NET AJAX ·þÎñÆ÷¿Ø¼þ£¨ScriptManager ¿Ø¼þ¡¢UpdatePanel ¿Ø¼þºÍ Timer ¿Ø¼þ£©°´¹Ì¶¨µÄʱ¼ä¼ä¸ô¸üв¿·ÖÍøÒ³¡£Í¨¹ý½«ÕâЩ¿Ø¼þÌí¼Óµ½ÍøÒ³ÉÏ£¬¿ÉÏû³ýÔÚÿ´Î»Ø·¢Ê±Ë¢ÐÂÕû¸öÒ³ÃæµÄÐèÒª¡£½«Ö»Ðè¸üРUpdatePanel ¿Ø¼þµÄÄÚÈÝ¡£
1¡¢ÔÚ Microsoft Visual Studio 2005 ......
1. ´ò¿ªÐµĴ°¿Ú²¢´«ËͲÎÊý£º
´«ËͲÎÊý£º
response.write("£¼script£¾window.open('*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"')£¼/script£¾")
½ÓÊÕ²ÎÊý£º
string a = Request.QueryString("id");
string b = Request.QueryString("id1");
2.Ϊ°´Å¥Ìí¼Ó¶Ô»°¿ò
Button1.Attributes.Add("o ......
ÔÚ×öASPÏîÄ¿µÄʱºò£¬ÅжÏÓû§ÊÇ·ñµÇ½³£Óõķ½·¨ÊÇÔÚÿ¸öÒ³ÃæÅжÏsessionÊÇ·ñ´æÔÚ£¬
ÎÞÄÎÓÃjavaµÄʱºò¹ýÂËÆ÷¾ÍÓõIJ»Êì¡£¡£¡£»¹ÊÇÓü̳аɡ£º¹¡£¡£¡£
н¨Ò»¸öÀà
Csharp ´úÂë
using System;
using System.Web;
using System.Web ......
DateTime dt = DateTime.Now;
//±¾ÔµÚÒ»Ììʱ¼ä
DateTime dt_First = dt.AddDays(-(dt.Day) + 1);
Label1.Text = dt_First.ToString("yyyy-MM-dd");
//½«±¾ÔÂÔÂÊý+1
DateTime dt2 = dt.AddMonths(1);
//±¾ÔÂ×îºóÒ»Ììʱ¼ä
DateTime dt_Last = dt2.AddDays( ......