[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
Ïà¹ØÎĵµ£º
Ê×ÏȽ¨Á¢Ò»¸öc/s³ÌÐò ÔÚн¨µÄformÉϼÓÈëÒ»¸öä¯ÀÀÆ÷¿Ø¼þºÍÒ»¸öʱ¼ä¿Ø¼þä¯ÀÀÆ÷¿Ø¼þÄÜתÏòÄãÒªÖ´ÐеÄÒ³Ãæ¶øʱ¼ä¿Ø¼þ¿ØÖƶàÉÙʱ¼äºó¹Ø±ÕÄãÒªÖ´ÐеÄÒ³ÃæÈ»ºóÉèÖÃformµÄvisibleΪfalse formµÄ״̬Ϊ×îС»¯ Ä¿µÄÊǽ«Õû¸öÖ´ÐеÄÒ³Ãæ³ÌÐò°üÔÚformµÄä¯ÀÀÆ÷¿Ø¼þÖÐÖ´Ðжøform»á±»Òþ²Ø ÕâÑù×öÉñ²»Öª¹í²»¾õ¡£×îºóÓÃwindowsµÄ¼Æ»®ÈÎÎñÿÌì ......
//´´½¨
HttpCookie cookie = new HttpCookie("user","111");//´´½¨Cookie
cookie Expires = DateTime.Now.Add(15);//ÉèÖùýÆÚʱ¼ä
Response.Cookies.Add(cookie);//´æÈë¿Í»§¶Ë
ÎÒÃÇÈ¡³öCookieÖµÒ²ºÜ¼òµ¥
string value = Request.Cookies["user"].value;
ÓÐʱºòÎÒÃÇÏëÔÚÒ»¸öCookieÖд¢´æ¶à¸öÐÅÏ¢£¬ÄÇÒ ......
ViewDataÓÐÒ»¸öModelStateµÄÊôÐÔ£¬ÕâÊÇÒ»¸öÀàÐÍΪModelStateDictionaryµÄModelStateÀàÐ͵Ä×ֵ伯ºÏ¡£ÔÚ½øÐÐÊý¾ÝÑéÖ¤µÄʱºòÕâ¸öÊôÐÔÊDZȽÏÓÐÓõġ£ÔÚʹÓÃHtml.ValidationMessage()µÄʱºò£¬¾ÍÊÇ´ÓViewData.ModelStateÖмì²âÊÇ·ñÓÐÖ¸¶¨µÄKEY£¬Èç¹û´æÔÚ£¬¾ÍÌáʾ´íÎóÐÅÏ¢¡£ÀýÈçÔÚǰһƪÎÄÕÂASP.NET MVC ÈëÃÅ7¡¢HellperÓëÊý¾ÝµÄÌá ......
¡¡¡¡Ê×Ïȼì²éWeb.configÎļþÀïÊÇ·ñÊÇÈçÏ´úÂ룺
¡¡¡¡´ò¿ªVS2005´´½¨ÐÂÏîÄ¿£¬Ñ¡ÔñASP.NET¡¡AJAXÏîÄ¿£¬È»ºó°Ñ¸ÃÏîÄ¿Web.configÎļþµÄÄÚÈÝÈ«²¿¸´ÖƵ½Ä㱨´íµÄWeb.configÎļþÀï¡£
¡¡¡¡Èç¹ûÕâ¸ö°ì·¨Î´Äܽâ¾ö°ì·¨Çë²é¿´¸ÃÏîÄ¿¸ùĿ¼µÄBinÎļþ¼ÐÄÚÊÇ·ñÓÐSystem.Web.Extensions.Design.dll¡¢System.Web.Extensions.dll¡¢A ......