Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ASP.NET µÄһЩ³£Óü¼Çɱ¸Íü1

1 »ñÈ¡´íÎóÐÅÏ¢²¢µ½Ö¸¶¨Ò³Ã治ҪʹÓÃResponse.Redirect,¶øÓ¦¸ÃʹÓÃServer.Transfer
e.g
// in global.asax
protected void Application_Error(Object sender, EventArgs e) {
if (Server.GetLastError() is HttpUnhandledException)
Server.Transfer("MyErrorPage.aspx");
//ÆäÓàµÄ·ÇHttpUnhandledExceptionÒì³£½»¸øASP.NET×Ô¼º´¦Àí¾ÍokayÁË :)
}
Redirect»áµ¼ÖÂpost£­backµÄ²úÉú´Ó¶ø¶ªÊ§ÁË´íÎóÐÅÏ¢£¬
ËùÒÔÒ³Ãæµ¼ÏòÓ¦¸ÃÖ±½ÓÔÚ·þÎñÆ÷¶ËÖ´ÐУ¬ÕâÑù¾Í¿ÉÒÔÔÚ´íÎó´¦ÀíÒ³ÃæµÃµ½³ö´íÐÅÏ¢²¢½øÐÐÏàÓ¦µÄ´¦Àí.
2 Çå¿ÕCookie
Cookie.Expires=[DateTime];
Response.Cookies("UserName").Expires = 0
3 »Ø³µ×ª»»³ÉTab
<script language="javascript" for="document" event="onkeydown">
¡¡if(event.keyCode==13 && event.srcElement.type!=’button’ &&
event.srcElement.type!=’submit’ && ¡¡¡¡¡¡¡¡event.srcElement.type!=’reset’
&& event.srcElement.type!=’’&& event.srcElement.type!=’textarea’);
¡¡¡¡¡¡event.keyCode=9;
</script>
onkeydown="if(event.keyCode==13) event.keyCode=9"
4 Ϊ°´Å¥Ìí¼Ó¶Ô»°¿ò
Button1.Attributes.Add("onclick","return confirm(’È·ÈÏ?’)");
button.attributes.add("onclick","if(confirm(’are you sure...?’)){return
true;}else{return false;}")
5 ¶ÁÈ¡DataGrid¿Ø¼þTextBoxÖµ
foreach(DataGrid dgi in yourDataGrid.Items)
{
¡¡TextBox tb = (TextBox)dgi.FindControl("yourTextBoxId");
¡¡tb.Text....
}
6 ×Ö·ûÐÍת»» תΪ×Ö·û´®
12345.ToString("n"); //Éú³É 12,345.00
12345.ToString("C"); //Éú³É £¤12,345.00
12345.ToString("e"); //Éú³É 1.234500e+004
12345.ToString("f4"); //Éú³É 12345.0000
12345.ToString("x"); //Éú³É 3039 (16½øÖÆ)
12345.ToString("p"); //Éú³É 1,234,500.00%


Ïà¹ØÎĵµ£º

·µ»Ø°´Å¥µÄʵÏÖ·½·¨£¨asp.net ÖУ©


·µ»Ø°´Å¥µÄʵÏÖ·½·¨£¨asp.net ÖУ©
Òý×Ô:http://blog.sina.com.cn/s/blog_49df2d0b0100aqoy.html
·µ»ØÉÏÒ»Ò³µÄÕâ¸ö¶«¶«ÔÚÎÒÃÇ×öÏîÄ¿µÄʱºòÒ»°ãÊÇÓÃÓÚÌîдÍê±íµ¥ºóÈ·ÈϵÄʱºò£¬ÓжÔÔ­À´ÊäÈëµÄÊý¾Ý½øÐÐÐÞ¸ÄʱÓõģ¬»òÕßÊÇÒòΪÍøվΪÁË·½±ãä¯ÀÀÕ߶øÓÐÐÄÌí¼Ó µÄÒ»¸ö¶«¶«£¬Ò»°ãÕâÖÖ¹¦ÄܵÄʵÏÖÔÚASP.netÖж¼ÊÇÓÃÒ»¸öbuttonµÄ¿ ......

asp.net 顯ʾUniCodeÌØÊâ×Ö·û

­1. Web.configÖÐÌí¼Ó:
     <globalization requestEncoding="utf-8" responseEncoding="utf-8"/>
2. 頁ÃæÖÐÌí¼Ó:
    <head>
     <meta http-equiv="Content-Type" content="charset=utf-8&qu ......

ÔÚASP.NETÖÐʹÓÃË®¾§±¨±í

      Ê×ÏÈÃèÊöÒ»ÏÂÎÊÌâ:ÒòΪ¿Í»§µÄÐèÒª,°ÑËùÓжÔÓÚÊý¾Ý¿âµÄ²Ù×÷×ö³ÉÁË´æ´¢¹ý³Ì,ͬʱҲ´æÔÚ´øÓÐÊäÈë²ÎÊýµÄ´æ´¢¹ý³Ì.¿Í»§ÒªÇó½«ËùÓеÄÐÅÏ¢¶¼¿ÉÒÔÓÃË®¾§±¨±íÏÔʾ.ÎÒÃǶ¼ÖªµÀ,ҪʹÓÃË®¾§±¨±íÎÒÃǾÍҪʹÓÃÊý¾ÝÔ´µÄ.ÔÚÕâÀï,ÎÒÃÇʹÓõÄÊý¾ÝÔ´×ÔÈ»¶øȻҲ¾ÍÊÇ´æ´¢¹ý³ÌÁË.µ±È»,ÎÒÃÇÒ²ÊÇÖªµÀµÄ,ÔÚADO.NETµÄÁ ......

ASP.NETÖÐÈçºÎ·À·¶SQL×¢Èëʽ¹¥»÷

1½«sqlÖÐʹÓõÄһЩÌØÊâ·ûºÅ£¬Èç' -- /* ; %µÈÓÃReplace()¹ýÂË£»
2ÏÞÖÆÎı¾¿òÊäÈë×Ö·ûµÄ³¤¶È£»
3¼ì²éÓû§ÊäÈëµÄºÏ·¨ÐÔ£»¿Í»§¶ËÓë·þÎñÆ÷¶Ë¶¼ÒªÖ´ÐУ¬¿ÉÒÔʹÓÃÕýÔò¡£
4ʹÓôø²ÎÊýµÄSQLÓï¾äÐÎʽ¡£ 
ASP.NETÖÐÈçºÎ·À·¶SQL×¢Èëʽ¹¥»÷ 
 
Ò»¡¢Ê²Ã´ÊÇSQL×¢Èëʽ¹¥»÷£¿
¡¡¡¡ËùνSQL×¢Èëʽ¹¥»÷£¬¾ÍÊǹ¥»÷Õß°Ñ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ