asp.net Ë®¾§±¨±íÈËÃñ±Ò´óд
ASP.NETÌṩÁËʼþÇý¶¯±à³ÌÄ£ÐÍ£¬Ê¹¿ª·¢Õß¼ò»¯ÁËÓ¦ÓóÌÐòµÄ×ÜÌåÉè¼Æ£¬µ«ÊÇÕâ¸öÒ²Ôì³ÉÁËËü¹ÌÓеÄһЩÎÊÌ⣬ÀýÈ磬ÔÚ´«Í³µÄASPÀÎÒÃÇ¿ÉÒÔͨ¹ýʹÓÃPOST·½·¨ºÜÈÝÒ×µØʵÏÖÒ³Ãæ¼ä´«µÝ±äÁ¿£¬Í¬ÑùµÄÊÂÇ飬ÔÚʹÓÃʼþÇý¶¯±à³ÌÄ£Ð͵ÄASP.NET¾ÍÒªÂ鷳һЩ£¬µ«ÊÇÎÒÃÇÈÔÈ»ÓÐһЩ·½·¨¿ÉÒÔʵÏÖͬÑùµÄ¹¦ÄÜ¡£±ÊÕßÔÚÕâÀォ°üº¬Ê¹ÓÃquerystring,session±äÁ¿ÒÔ¼°server.Transfer·½·¨À´ÊµÏÖÒ³Ãæ¼äµÄ±äÁ¿´«µÝ¡£
ʹÓÃQueryString
ʹÓÃQueryStingÔÚÒ³Ãæ¼ä´«µÝÖµÒѾÊÇÒ»ÖÖºÜÀϵĻúÖÆÁË£¬ÕâÖÖ·½·¨µÄÖ÷ÒªÓŵãÊÇʵÏÖÆðÀ´·Ç³£¼òµ¥£¬È»¶øËüµÄȱµãÊÇ´«µÝµÄÖµÊÇ»áÏÔʾÔÚä¯ÀÀÆ÷µÄµØÖ·À¸Éϵģ¨²»°²È«£©£¬Í¬Ê±ÓÖ²»ÄÜ´«µÝ¶ÔÏ󣬵«ÊÇÔںܶഫµÝµÄÖµÉÙ¶ø°²È«ÐÔÒªÇ󲻸ߵÄÇé¿öÏ£¬Õâ¸ö·½·¨»¹Êǽ϶àµØ±»Ê×ѡʹÓá£
ʹÓÃÕâÖÖ·½·¨°üÀ¨ÈçϵIJ½Öè:
a£¬Ê¹Óÿؼþ´´½¨web±íµ¥£¨form£©
b£¬´´½¨¿ÉÒÔ·µ»Ø±íµ¥µÄ°´Å¥ºÍÁ´½Ó°´Å¥
c£¬ÔÚ°´Å¥»òÁ´½Ó°´Å¥µÄµ¥»÷ʼþÀï´´½¨Ò»¸ö±£´æURLµÄ×Ö·û±äÁ¿
d£¬ÔÚ±£´æµÄURLÀïÌí¼ÓQueryString²ÎÊý
e£¬Ê¹ÓÃResponse.RedirectÖض¨Ïòµ½ÉÏÃæ±£´æµÄURL
ÏÂÃæµÄ´úÂëƬ¶ÏÑÝʾÁËÈçºÎʵÏÖÕâ¸ö·½·¨£º
Ô´Ò³Ãæ´úÂ룺
private void Button1_Click
(object sender, System.EventArgs e)
{
string url;
url="webform1.aspx?var1=" + TextBox1.Text + "&var2=" + TextBox2.Text;
Response.Redirect(url);
}
Ä¿±êÒ³Ãæ´úÂ룺
private void Page_Load
(object sender, System.EventArgs e)
{
Label1.Text=Request.QueryString["var1"];
// Label1.Text=Request.QueryString["var1"] Ò²¿ÉÒÔֱдΪ Label1.Text=Request["var1"]ÏÂÃæµÄÓï¾äÒ²ÊÇÒ»Ñù¿ÉÒÔ¼òд
Label2.Text=Request.QueryString["var2"];
}
ʹÓÃSession±äÁ¿
ʹÓÃSession±äÁ¿ÊÇ¿ÉÒÔÔÚÒ³Ãæ¼ä´«µÝÖµµÄµÄÁíÒ»ÖÖ·½Ê½£¬ÔÚ±¾ÀýÖÐÎÒÃǰѿؼþÖеÄÖµ´æÔÚSession±äÁ¿ÖУ¬È»ºóÔÚÁíÒ»¸öÒ³ÃæÖÐʹÓÃËü£¬ÒÔ²»Í¬Ò³Ãæ¼äʵÏÖÖµ´«µÝµÄÄ¿µÄ¡£µ«ÊÇ£¬ÐèҪעÒâµÄÊÇÔÚSession±äÁ¿´æ´¢¹ý¶àµÄÊý¾Ý»áÏûºÄ±È½Ï¶àµÄ·þÎñÆ÷×ÊÔ´£¬ÔÚʹÓÃsessionʱӦ¸ÃÉ÷ÖØ£¬µ±È»ÁË£¬ÎÒÃÇÒ²Ó¦¸ÃʹÓÃһЩÇåÀí¶¯×÷À´È¥³ýһЩ²»ÐèÒªµÄsessionÀ´½µµÍ×ÊÔ´µÄÎÞνÏûºÄ¡£Ê¹ÓÃSession±äÁ¿´«µÝÖµµÄÒ»°ã²½ÖèÈçÏ£º
a£¬ÔÚÒ³ÃæÀïÌí¼Ó±ØÒªµÄ¿Ø¼þ
b£¬´´½¨¿ÉÒÔ·µ»Ø±íµ¥µÄ°´Å¥ºÍÁ´½Ó°´Å¥
c£¬ÔÚ°´Å¥»òÁ´½Ó°´Å¥µÄµ¥»÷ʼþÀ°Ñ¿Ø¼þµÄÖµÌí¼Óµ½session±äÁ¿Àï
d
Ïà¹ØÎĵµ£º
ÔÚASP.NET MVC beta·¢²¼Ö®Ç°£¬M$¾ÍÐû²¼Ö§³Ö¿ªÔ´µÄJS¿ò¼ÜjQuery£¬È»ºóASP.NET MVC
beta·¢²¼ºó£¬Ä㽨Á¢Ò»¸öASP.NET MVC betaµÄÏîÄ¿ºó£¬Äã¿ÉÒÔÔÚÏîÄ¿µÄscriptsĿ¼ÏÂÕÒµ½ASP.NET
AJAXºÍjQueryµÄJS¡£·´ÕýÎÒÊDZȽÏϲ»¶jQueryµÄ£¬ËùÒÔ¶ÔÓÚM$´Ë¾Ù»¹ÊÇͦÐÀοµÄ¡£
·Ï»°²»¶à˵£¬ÎÒÃÇʹÓÃAJAXÀ´ÊµÏÖ·¢±íÆÀÂ۵ŦÄÜ°É¡£ÏÈÀ´¿´¿´ÔõÑ ......
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.SqlClient; ......
Ò».ÕªÒª
¡¡¡¡ºÍ×ÔÉíˮƽÓйØ, ÎÒ×Üϲ»¶Ð´ÈëÃż¶±ðµÄÎÄÕÂ.±ÈÈçËäÈ»×öÏîÄ¿ÓùýÒ»¸öÄÚ²¿µÄMVC¿ò¼Ü, µ«Êǵ±¿´µ½ASP.NET MVCʱÎÒÈ´»¹ÊDz»ÖªµÀ´ÓÄÄÀïÈëÊÖ¿ªÊ¼Ñ§Ï°µÄºÃ.ÓÚÊÇÎÒдÏÂÕâƪÈëÃż¶µÄϵÁÐÎÄÕÂ,¡¡ ½«ÀÏÕÔ(Jeffrey Zhao)µÄASP.NET MVCϵÁÐÊÓƵ¿Î³Ìѧµ½µÄ֪ʶÔÙÀí½âºÍÔÙÏû»¯, ÈÃ×µÄÈËÒ²Äܸú×ÅÎÒѧ¶®ASP.NET MVC
¡¡¡¡¶þ. ......
<script language="javascript">
function init()
{
var tbBody = document.getElementById("<%=GridView2.ClientID%>");
  ......