ASP.NET·µ»ØÉÏÒ»Ò³ÃæʵÏÖ·½·¨×ܽá
·µ»ØÉÏÒ»Ò³µÄÕâ¸ö¶«¶«ÔÚÎÒÃÇ×öÏîÄ¿µÄʱºòÒ»°ãÊÇÓÃÓÚÌîдÍê±íµ¥ºóÈ·ÈϵÄʱºò£¬ÓжÔÔÀ´ÊäÈëµÄÊý¾Ý½øÐÐÐ޸ĻòÕ߸üÐÂʱÓõģ¬»òÕßÊÇÒòΪÍøվΪÁË·½±ãä¯ÀÀÕ߶øÓÐÐÄÌí¼ÓµÄÒ»¸ö¶«¶«£¬Ò»°ãÕâÖÖ¹¦ÄܵÄʵÏÖÔÚASP.NETÖж¼ÊÇÓÃÒ»¸öButton¿Ø¼þÀ´ÊµÏֵģ¬ÊµÏֵķ½·¨Óкܶ࣬½ñÌìÇ¡ºÃÔÚ×öÏîĿʱÅöµ½ÒªÓÃÕâ¸ö¶«¶«£¬ÎҾͰÑÄÜʵÏÖ" ·µ»ØÉÏÒ»Ò³","·µ»ØÇ°Ò»Ò³"µÄ¼¸ÖÖ·½·¨×ܽáÁËһϣ¬¹©´ó¼Òѧϰ֮Óã¬Çë¶à¶àÖ¸½Ì:
ÆäʵҪʵÏÖÕâ¸ö¹¦ÄÜÖ÷Òª»¹ÊÇÒªÓõ½javascript½Å±¾ÓïÑÔ£¡
·½·¨Ò»£º
ÔÚasp.netµÄaspxÀïÃæµÄÔ´´úÂëÖÐ
<input type="button onclick="javascript:window.history.go(-1);"value="·µ»ØÉÏÒ»Ò³">
dzÎö£ºÕâ¸öÊÇÓÃÁËHTML¿Ø¼þ£¬Í¨¹ýÒ»¸öonclickµÄʼþ£¬µ÷ÓÃÁËjavascriptÖеÄÒ»¸ö·½·¨¾Í¿ÉÒÔÁË¡£Õâ¸öÊÇ×î¼òµ¥µÄÁË£¬Ò²Í¬ÑùÊÊÓÃÓÚ¾²Ì¬Ò³Ãæ,ASPÒ³ÃæµÈ¡£
·½·¨¶þ:
ÀûÓÃReponse.write()
Èç¹ûÄã¶ÔASPÓÐÒ»¶¨µÄÁ˽⣬ÄÇô¶ÔResponse.writeÕâ¸ö¶«¶«¾Í²»»áÄ°ÉúÁË£¬·½·¨Ò»ÊÇÖ±½ÓÓÐHTMLÒ³ÃæÖÐʵÏÖ£¬ÔòÕâ¸öÔòÊÇÔÚºǫ́»·¾³ÖÐʵÏÖ£¨Õâ¸ö˵·¨ºÃÏñ²»ÊǺܹ淶£¬ºÇºÇ)
Response.write("<script language=javascript>history.go(-2);</script>)
<a href="#" onclick="javascript:history.back();">·µ»ØÇ°Ò»Ò³</a>
ÕâÀïΪ»áôҪ²ÉÓÃ-2µÄÖµÄØ£¬ÎÒ¸öÈËÈÏΪÊÇÕâÑùµÄ£ºÒòΪÔÚasp.netÖеÄÒ³Ã棬µ±Äã°´ÏÂÒ»¸öbuttonºó£¬ÓÉÓÚÒ³ÃæÖлáʵÏÖpage.postbackµÄÔµ¹Ê£¬Êµ¼ÊÉÏÔÚÕâÆäÖÐÊÇË¢ÐÂÁËÁ½´ÎÒ³Ã棬ÎÒÃÇÒªµÄÊǵÚÒ»´ÎµÄ£¬ËùÒÔ¾Í......
·½·¨Èý:
ÀûÓÃResponse.Redirect() »ò server.transfer()
ÔÚpage_loadÖмÓÈë
if(!IsPostBack)
ViewState["retu"]=Request.UrlReferrer.ToString();
¶øÔÚÔÚ·µ»Ø°´Å¥Ê¼þÖÐ
Response.Redirect(ViewState["retu"].ToString());
»òServer.Transfer (ViewState["retu"].ToString());
dzÎö£º
Request.UrlReferrer¿ÉÒÔ»ñÈ¡¿Í»§¶ËÉÏ´ÎÇëÇóµÄurlµÄÓйØÐÅÏ¢£¬ÎÒÃÇÔÚʹÓÃÕâ¸öµÄʱºò×îºÃ¶ÔÆä½øÐÐÒ»¸öÅжÏ
if(ViewState["UrlReferrer"]!=null)
Response.Redirect(ViewState["UrlReferrer"].ToString();
else{
Response.write("¶Ô²»Æ𣬵±Ç°ÊÇ×îÇ°Ò³Âë“£©£»ÕâÑù²
Ïà¹ØÎĵµ£º
http://blog.csdn.net/chengking/archive/2005/10/27/518079.aspx
(Ò»).Ñ¡Ôñ»á»°×´Ì¬´æ´¢·½Ê½
ÔÚWebconfigÎļþÅäÖÃ:
<sessionState mode="???" stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString ......
1.TextBox txt=(TextBox)PreviousPage.FindControl("TextBox1");
2.ÔÚÒ³Ãæ×¢²áͶµÝÒ³µÄÊôÐÔ
<%@ PreviousPageType VirtualPath="crouspostPage.aspx" %>
ÔÚcrouspostPage.aspxµÄ´úÂëÒþ²ØÀàÖÐÌí¼Ó
public TextBox TextBox1
{
get(return _textbox);
}
ÔÚÒ³ÃæÖÐResponse.Write(PreviousPage. ......
×÷Õߣº°½Ê¿Î°
Ò»¡¢ÏîÄ¿ÖÐÒýÓÃlog4net.dll
¶þ¡¢AssemblyInfo.csÖмÓÈ룺
[assembly:log4net.Config.DOMConfigurator(ConfigFile="log4net.xml", Watch=true)]
˵Ã÷£ºÖ¸Ã÷log4net.xmlÅäÖÃÎļþ
Èý¡¢´úÂëÖÐʹÓÃLog4net
using log4net;
ILog log = LogManager.GetLogger("log4net");
log.Info("It's OK!");
¸½£ ......
¼Ù¶¨ÓÐÒ»¸öProduct±í£¬×Ö¶ÎÓУ¨Id,Name,Quantity,...£©½«QuantityÁÐÓÃtextbox¸ñʽÀ´ÏÔʾ£º
Ê×ÏÈÔÚGridviewÖУ¬QuantityÁÐÒÔTemplateFieldÏÔʾ£¬ÆäËûµÄÁÐÊôÐÔÉèΪֻ¶Á£¬°ÑÏÔʾ¸ñʽÉèΪTextBox
<asp:TemplateField HeaderText="Quantity">
<ItemTemplate>
&nbs ......