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

ASP.NET MVC ÈëÃÅ

ViewDataÓÐÒ»¸öModelStateµÄÊôÐÔ£¬ÕâÊÇÒ»¸öÀàÐÍΪModelStateDictionaryµÄModelStateÀàÐ͵Ä×ֵ伯ºÏ¡£ÔÚ½øÐÐÊý¾ÝÑéÖ¤µÄʱºòÕâ¸öÊôÐÔÊDZȽÏÓÐÓõġ£ÔÚʹÓÃHtml.ValidationMessage()µÄʱºò£¬¾ÍÊÇ´ÓViewData.ModelStateÖмì²âÊÇ·ñÓÐÖ¸¶¨µÄKEY£¬Èç¹û´æÔÚ£¬¾ÍÌáʾ´íÎóÐÅÏ¢¡£ÀýÈçÔÚǰһƪÎÄÕÂASP.NET MVC ÈëÃÅ7¡¢HellperÓëÊý¾ÝµÄÌá½»Óë°ó¶¨ÖÐʹÓõ½µÄUpdateModel·½·¨£º

ÎÒÃÇÔÚViewÖÐʹÓÃHtml.ValidationMessage(string modelName)À´¶ÔÖ¸¶¨µÄÊôÐÔ½øÐÐÑéÖ¤£º

Html.ValidationMessage()Óм¸¸öÖØÔØ£º
ÆäÖÐValidationSummary()ÊÇÓÃÓÚÏÔʾȫ²¿µÄÑéÖ¤ÐÅÏ¢µÄ¡£¸úASP.NETÀïÃæµÄValidationSummaryÑéÖ¤¿Ø¼þ²î²»¶à¡£
ÎÒÃDzâÊÔÒ»ÏÂ/Admin/SettingÒ³Ã棺

ÔÚÓÃUpdateModel·½·¨¸üÐÂBlogSettings.Instance.PostsPerPageµÄʱºò£¬µ±ÎÒÃÇÈçͼËùʾÌîд"10d"µÄʱºò£¬ÓÉÓÚPostsPerPageΪÕûÐ͵ģ¬ËùÒÔUpdateModel·½·¨¾Í»á³ö´í£¬Í¬Ê±»áÍùViewData.ModelStateÌí¼ÓÏàÓ¦µÄ´íÎóÐÅÏ¢£¬´Ó¶øHtml.ValidationMessage()·½·¨¾Í¿ÉÒÔ´ÓViewData.ModelStateÖмì²âµ½´íÎó²¢Ìáʾ¡£Í¬Ê±Html.ValidationMessage()·½·¨»áΪ³ö´íµÄÊôÐÔµÄÊäÈë¿òÌí¼ÓÒ»¸öÃûΪ"input-validation-error"µÄCSSÀ࣬ͬʱºóÃæµÄÌáʾÐÅÏ¢µÄCSSÀàÃûΪ"field-validation-error"£º

CSSÀàµÄÑùʽÊÇ¿ÉÒÔÓÉÎÒÃÇ×Ô¼º×ÔÓɶ¨ÒåµÄ¡£ÈçÉÏͼµÄºìÉ«¸ßÁÁÏÔʾ¡£
ºÃ£¬ÏÂÃæÎÒÃÇÀ´ÊµÏÖ·¢±íÐÂËæ±ÊµÄ¹¦ÄÜ¡£ÎÒÃÇÏÈдһ¸öÌṩÓû§ÊäÈëËæ±ÊÄÚÈÝµÄ±íµ¥Ò³Ã棺
<p>
    <label for="Title">±êÌâ</label>
    <%=Html.TextBox("Title", new { id = "Title", @class = "required" })%>
    <%=Html.ValidationMessage("Title")%>
</p>
<p>
    <label for="Content">ÄÚÈÝ</label>
    <%=Html.TextArea("Content")%>
    <%=Html.ValidationMessage("Content")%>
</p>
<p>
    <label for="Slug">URLµØÖ·±ðÃû(Èç¹ûΪ¿ÕÔòºÍ±êÌâͬÃû)</label>
    <%=Html.TextBox("Slug", new { id = "Slug", @class = "required" })%>
    <%=Html.ValidationMessage("Slug")%>
</p> 
 
È»ºóÎÒÃǶÔÓû§Ìá½»¹ýÀ´µÄÊý¾Ý½øÐб£´æ£º
[AcceptVerbs("PO


Ïà¹ØÎĵµ£º

ASP.NET°²È«ÈÏÖ¤ ËÄ

——ÇÉÃîʵÏÖ Form ±íµ¥ÈÏÖ¤¿çÕ¾µã¡¢¿ç·þÎñÆ÷µÄµ¥µãµÇ¼£¨Single Sign On£©
×÷Õߣºº®Óð·ã(cityhunter172)
µÚËIJ¿·Ö Form ÈÏÖ¤µÄ²¹³ä
Ç°ÈýƪÔÚ CSDN ÂÛ̳¹«²¼ºó£¬Ð§¹ûÈçͬ“ÉñÏÉ·Åƨ——¹ûÈ»²»Í¬·²£¨·´£©Ï씡£Îª¸Ðл¹ã´óÍøÓѵÄÈÈÇéÓëÖ§³Ö£¬Õâ²»£¬¾­¹ýÕâÒ»Õó×ÓµÄÔÍÄð¡¢ÐÞÁ¶£¬ÌØÒâ×¼±¸ÁËÕâµ ......

ASP.NETÖÐServer.MapPathµÄ¼¸ÖÖÓ÷¨

 1.Server.MapPath("/") //Ó¦ÓóÌÐò¸ùĿ¼ËùÔÚµÄλÖà Èç C:\Inetpub\wwwroot\
2.Server.MapPath("./") //±íʾËùÔÚÒ³ÃæµÄµ±Ç°Ä¿Â¼
//×¢£ºµÈ¼ÛÓÚServer.MapPath("") ·µ»Ø Server.MapPath("")ËùÔÚÒ³ÃæµÄ//ÎïÀíÎļþ·¾¶
3.Server.MapPath("../")//±íʾÉÏÒ»¼¶Ä¿Â¼
4.Server.MapPath("~/../");//±íʾ±¾ÎļþËùÔÚÎļþ¼ ......

ASP.NETÖÐbin app_code app_dataµÈÎļþ¼ÐµÄ×÷ÓÃ

 ×ªÌù×Ô  http://wuxiong8665.blog.163.com/blog/static/93512200991811400157/
¸ÅÀÀ£º
 Îļþ¼ÐÃû³Æ
   ÎļþÀàÐÍ
   ×¢        ÊÍ
 Bin
  .dll
    °üº¬Ó¦ÓóÌÐòËùÐèµÄÈκÎÔ¤Éú³ÉµÄ³ÌÐò¼¯
 App_Browsers
&n ......

ASP.NET ÏÂweb.config FormsÉí·ÝÑéÖ¤µÄÅäÖÃ

 ÔÚwebconfigÖÐÓÐÒ»¸öÖØÒª½Úµã <system.web> ÆäÖаüÀ¨ÁËÒ»¸öÉí·ÝÑéÖ¤ÅäÖýڵã
<authentication mode="Windows"/>
ÆäÖÐ authentication ÊǽڵãÃû£¬modeÊÇģʽ£¬ÉÏÊö´úÂë±íʾ ²ÉÓÃwindowsÉí·ÝÑéÖ¤£¬ÄÇô´ËʱÉí·ÝÑéÖ¤½«½»¸øiis´¦Àí£¬¶øiisÖÐĬÈÏÉè
  <authentication mode="Forms" >
 &n ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ