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

ÔÚajaxÖУ¬ÊDz»ÊÇviewstateûÓÃÁË£¿

ÎÒÔÚPage_LoadÖгõʼ»¯ÁËviewstate["s1"]µÄÖµ£¬ÔÚÁíÍâij¸öʼþRefreshClickÖиıäÁËviewstate["s1"]µÄÖµ¡£ºóÀ´£¬ÎÒµ÷ÊÔ³ÌÐò£¬·¢ÏÖÖµ¾ÓȻûÓиı䣬»¹ÊÇÎÒÔÚPage_LoadÖÐÉèÖõÄÖµ£¬ÕæÊÇÆæ¹Ö¡£
ÇëÎÊ£ºviewstateÊDz»ÊÇÔÚajaxûÓÃÁË?

ÁíÍâÔÚRefreshClickʼþÖÐÎÒ¼ÓÁËÒ»¾ä£º¡°GridPanel1.Reload(); ¡±ËäÈ»ÎÒ·¢ÏÖÕâ¾ä²»½â¾öÎÊÌâÎÒɾ³ýÁË£¬µ«ÊÇÎÒ·¢ÏÖÒ»¼þÆæ¹ÖµÄÊÂÇ飬 ³ÌÐòÖ´Ðкóµ÷ÓÃÁËpage_load£¬ÔÙµ÷ÓÃÁËRefreshClick£¬ÕâÎÒ¾õµÃÕý³££¬µ«ÊÇËüÓÖµ÷ÓÃÁËpage_loadÒ»±é£¬ÕæÊǸ㲻¶®¡£ÊDz»ÊÇReload()רΪ¿Í»§¶ËÉè¼ÆµÄ£¿
ÔÚajaxÖÐ £¬ÊÇÕâÑù¡£Èç¹ûÄãµÄHTML È«ÊÇJS  ajax µÄ»° Äã¿ÉÒÔÍêÈ«½ûÓÃVIEWSTATE.
 

ÓÐÓÃѽ£¬viewstate£¬session£¬application¶¼»áÓÐÓᣵ«ÊÇÈç¹ûÒ³ÃæÉÏûÓÐrunat=¡°server¡±µÄ²¿·Ö£¬¾ÍÊÇ˵ûÓÐviewstateµÄ»°£¬ÄǾÍÓò»³ÉÁË

ÓÐÓÃ

ʵ¼ÊÉÏ£¬ajaxÒ²ÊÇget»òpostÒ³Ãæ
¶øget»òpostÒ³Ãæ
¶¼»áÖ´Ðе½Page_Load·½·¨£¬ÕâÊÇasp.netÒ³Ã涨ÒåµÄʼþ˳Ðò



ËùÒÔ£¬asp.net¶¨ÒåÁË2¸öÊôÐÔ
IsPostBackָʾµ±Ç°ÊÇPost»Ø·¢Ò³Ãæ
IsCallBackָʾµ±Ç°Êǻص÷Ò³Ã棨ע£ºÈç¹ûÊÇ×Ô¼ºÐ´µÄXmlHttp£¬Õâ¸öÖµ¾Í²»×¼È·ÁË£©

ÓÐÓõġ£

ѧϰ.!

¿ÉÒÔʹÓá£
ÊÇ·ñ¼ÓÁË
if(!IsPostBack)
{
Id="";
}
public string Id
{
get{  return ViewState["Id"].ToString();}
set{  ViewState["Id"]=value;}
}
Ö´ÐÐÆäËû²Ù×÷£¬Ò³Ãæ»Ø´«»áÖ´ÐÐPage_Load

ding

ÎÒÔÚPage_LoadÖе±È»Ê¹ÓÃÁËif(!Page.IsPostBack) { viewstate["s1&qu


Ïà¹ØÎÊ´ð£º

AjaxÓëSessionµÄÎÊÌâ - .NET¼¼Êõ / ASP.NET

֮ǰÓöµ½Ò»¸öÎÊÌâ¡£
ÓÚÊÇ×öÁËÒÔÏÂʵÑ飺
Ò³Ãæ¼ÓÔغó£¬Ìá½»Ò»¸öAjaxÇëÇó(ÔݳÆΪajax1)£¬ÇëÇóµÄÏß³ÌÔÚ·þÎñÆ÷Éϱ»Ë¯Ãß10ÃëÖÓ¡£
µã»÷Ò³ÃæÉÏÒ»¸öbutton£¬´¥·¢ÁíÒ»¸öAjaxÇëÇó(ajax2)¡£
µ±Ã»ÓÐʹÓÃsession£¬ÔÚ·þÎñÆ÷δ´ ......

Visual Web Developer 2008°²×°AJAXÎÊÌ⣡°ï°ïæ°¡£¡

Çë¸ç¸ç½ã½ãµÜµÜÃÃÃÃÊåÊå°¢ÒÌÃÇ°ï°ïæ
ÎÒÓö¼ûÁËÒ»¸ö¸úÄúÒ»ÑùµÄÎÊÌ⣬¾ÍÊÇÎÒµÄ Visual Web Developer 2008 ¼òÌå°æ °²×°AJAXµÄʱºòÒ²³öÏÖÎÊÌ⣬ÎÒÏÂÔØAjaxControlToolkit
ÁËÒ²½âѹÁË£¬µ«ÊÇûÓа²×°AspAjaxExtSetu ......

Jquery1.3.2µÄAJAXÎÊÌâ

HuiFu.aspxÒ³Ãæ


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="HuiFu.aspx.cs" Inherits="fdfdcs" %>

<!DOCTYPE html PUBLIC &q ......

jquery ajax json webService ÎÊÌâ

¡¡javascript´úÂëÈçÏ£º

$(document).ready(function() {
            $("#btn2").click(function() {
¡¡¡¡            $.aja ......

ÈçºÎ»ñÈ¡AjaxÒ³ÃæÖÐinnerHtml

Èç½ðɽ´Ê°ÔÍøÒ³×óÉϽÇÉϵÄÿÈÕÒ»¾ä
$('#elementID').html();
Ó¦¸Ã¿ÉÒÔ°É

±ð³ÁÁË°¡£¡~£¡

ÎÊÌâ²»¹»ÇåÎú

document.getElementById("¿Ø¼þID").innerHtml;

h ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ