[ASP.NET]¹¤×÷Öо³£Ê¹Óõ½µÄ·½·¨
1¡¢¸øɾ³ý°´Å¥Ìí¼ÓÊÇ·ñÈ·ÈÏÌáʾ£º
ǰ̨·½·¨£ºOnClientClick="return window.confirm('ÄãÈ·¶¨ÒªÉ¾³ýÂð£¿')"
ºǫ́·½·¨£ºbtnDelete.Attributes.Add("onclick", "return confirm('ÄúÈ·¶¨ÒªÉ¾³ýÂð£¿');");
2¡¢DataSetÖÐÈ¡Öµ£º
lblTitle.Text = ds.Tables[0].Rows[0]["Title"].ToString();
3¡¢×Ö·û´®½ØÈ¡·½·¨:
public string StringFormat(int len, string str)
{
return (str.Length > len) ? str.Substring(0, len) + " ..." : str;
}
4¡¢GridViewʼþÖлñÈ¡GridViewÖеĿؼþ:
LinkButton lbtnManager = e.Row.FindControl("lbtnManager") as LinkButton;
5¡¢»ñÈ¡GridViewµÄDataKeyNamesÖÐÖ÷¼üµÄIDÖµ£º
int id = Convert.ToInt32((sender as GridView).DataKeys[e.Row.RowIndex].Value.ToString());
6¡¢ViewStateµÄÓ¦Óãº
[Íøվǰ̨,¾¡Á¿½ûÓÃViewState;µ±È»Ò²×îºÃ²»ÒªÊ¹ÓÃPostBack]
public string vsEName
{
get
{
if (EnableViewState)
{
object obj = ViewState["eName"];
if (obj != null)
return (string)obj;
else
return string.Empty;
}
else
return string.Empty;
}
set
&nb
Ïà¹ØÎĵµ£º
1.Server.MapPath("/") //Ó¦ÓóÌÐò¸ùĿ¼ËùÔÚµÄλÖà Èç C:\Inetpub\wwwroot\
2.Server.MapPath("./") //±íʾËùÔÚÒ³ÃæµÄµ±Ç°Ä¿Â¼
//×¢£ºµÈ¼ÛÓÚServer.MapPath("") ·µ»Ø Server.MapPath("")ËùÔÚÒ³ÃæµÄ//ÎïÀíÎļþ·¾¶
3.Server.MapPath("../")//±íʾÉÏÒ»¼¶Ä¿Â¼
4.Server.MapPath("~/../");//±íʾ±¾ÎļþËùÔÚÎļþ¼ ......
Ê×ÏȽ¨Á¢Ò»¸öc/s³ÌÐò ÔÚн¨µÄformÉϼÓÈëÒ»¸öä¯ÀÀÆ÷¿Ø¼þºÍÒ»¸öʱ¼ä¿Ø¼þä¯ÀÀÆ÷¿Ø¼þÄÜתÏòÄãÒªÖ´ÐеÄÒ³Ãæ¶øʱ¼ä¿Ø¼þ¿ØÖƶàÉÙʱ¼äºó¹Ø±ÕÄãÒªÖ´ÐеÄÒ³ÃæÈ»ºóÉèÖÃformµÄvisibleΪfalse formµÄ״̬Ϊ×îС»¯ Ä¿µÄÊǽ«Õû¸öÖ´ÐеÄÒ³Ãæ³ÌÐò°üÔÚformµÄä¯ÀÀÆ÷¿Ø¼þÖÐÖ´Ðжøform»á±»Òþ²Ø ÕâÑù×öÉñ²»Öª¹í²»¾õ¡£×îºóÓÃwindowsµÄ¼Æ»®ÈÎÎñÿÌì ......
¼ìË÷ COM À๤³§ÖÐ CLSID Ϊ {000209FF-0000-0000-C000-000000000046} µÄ×é¼þʱʧ°Ü£¬ÔÒòÊdzöÏÖÒÔÏ´íÎó: 80070005¡£
˵Ã÷: Ö´Ðе±Ç° Web ÇëÇóÆڼ䣬³öÏÖδ´¦ÀíµÄÒì³£¡£Çë¼ì²é¶ÑÕ»¸ú×ÙÐÅÏ¢£¬ÒÔÁ˽âÓйظôíÎóÒÔ¼°´úÂëÖе¼Ö´íÎóµÄ³ö´¦µÄÏêϸÐÅÏ¢¡£
Òì³£ÏêϸÐÅÏ¢: System.UnauthorizedAccessException: ¼ìË÷ COM À๤ ......
ʲôÊÇMVCģʽ
MVC£¨Model-View-Controller£¬Ä£ÐÍ—ÊÓͼ—¿ØÖÆÆ÷ģʽ£©ÓÃÓÚ±íʾһÖÖÈí¼þ¼Ü¹¹Ä£Ê½¡£Ëü°ÑÈí¼þϵͳ·ÖΪÈý¸ö»ù±¾²¿·Ö£ºÄ£ÐÍ£¨Model£©£¬ÊÓͼ£¨View£©ºÍ¿ØÖÆÆ÷£¨Controller£©¡£
ÄÇôMVCģʽºÍÎÒÃÇÊìϤµÄWebFormģʽÓÐʲô²»Í¬ÄØ£¿ËûµÄ¸÷¸ö²¿·ÖÓÖÊÇÔõÑù·Ö¹¤µÄÄØ£¿
ÎÒÃÇÏÈÀ´¿´Ò»ÏÂÆÕͨµÄWebFormģʽÏ£ ......
ÔÚASP.Net MVCÀàÐ͵ÄÏîÄ¿ÖÐÓÒ»÷Controller Îļþ¼Ð£¬Ñ¡ÖÐAdd=>Controller¡ºó£¬»áÔÚн¨µÄController ÖвåÈëһЩĬÈÏ´úÂë¡£ ÔÚController µÄ¸÷¸öAction·½·¨ÖÐÓÒ»÷ Add View¡£¬Ò²»áÔÚн¨µÄViewÖвåÈëһЩ´úÂë¡£ÔÚн¨Viewʱ²åÈëµÄ´úÂë»á¸ù¾ÝÉÏÏÂÎĺÍÄãµÄÑ¡Ôñ¶ø²»Í¬£¬ËƺõÓкܴóµÄ´úÂëÉú³É¹¦ÄÜ¡£ ÉÏÊöÁ½ÕßÉú³É´ ......