我用prototype.js框架来做Ajax,可当我读取aspx的页面源代码时,怎么跟我用浏览器访问aspx文件时的源代码怎么不一样啊?
例如:test.aspx
它的前台页面源代码是
我在它的page_load方法中写了如下字符
当我用浏览器访问这个页面时,页面显示234,源代码如下
,但当我用prototype的 new Ajax.Request("test.aspx",{相关参数})来读取时,发现它读出的源代码竟然没有234,如下
读出来的源代码是
他读出的html源代码不是动态的html源代码,好像后面的page_load方法就没有运行一样?这怎么回事?
例如:test.aspx
它的前台页面源代码是
1<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" %>
2
3<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
5<html xmlns="http://www.w3.org/1999/xhtml" >
6<head runat="server">
7 <title>无标题页</title>
8</head>
9<body>
10 <form id="form1" runat="server">
11 <div>
12 <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /><br />
13 <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="login.aspx?ComeUrl=http://test.com.cn">HyperLink</asp:HyperLink> </div>
14 </form>
15</body>
16</html>
17
后台代码是2
3<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
5<html xmlns="http://www.w3.org/1999/xhtml" >
6<head runat="server">
7 <title>无标题页</title>
8</head>
9<body>
10 <form id="form1" runat="server">
11 <div>
12 <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /><br />
13 <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="login.aspx?ComeUrl=http://test.com.cn">HyperLink</asp:HyperLink> </div>
14 </form>
15</body>
16</html>
17
1using System;
2using System.Data;
3using System.Configuration;
4using System.Collections;
5using System.Web;
6using System.Web.Security;
7using System.Web.UI;
8using System.Web.UI.WebControls;
9using System.Web.UI.WebControls.WebParts;
10using System.Web.UI.HtmlControls;
11using System.Drawing;
12using System.Drawing.Drawing2D;
13using System.Drawing.Imaging;
14
15public partial class test : System.Web.UI.Page
16{
17 private void Page_Load(object sender, EventArgs e)
18 {
19 this.HyperLink1.Text = "234";
20
21 }
22
23 protected void Button1_Click(object sender, EventArgs e)
24 {
25
26 }
27
28}
29
2using System.Data;
3using System.Configuration;
4using System.Collections;
5using System.Web;
6using System.Web.Security;
7using System.Web.UI;
8using System.Web.UI.WebControls;
9using System.Web.UI.WebControls.WebParts;
10using System.Web.UI.HtmlControls;
11using System.Drawing;
12using System.Drawing.Drawing2D;
13using System.Drawing.Imaging;
14
15public partial class test : System.Web.UI.Page
16{
17 private void Page_Load(object sender, EventArgs e)
18 {
19 this.HyperLink1.Text = "234";
20
21 }
22
23 protected void Button1_Click(object sender, EventArgs e)
24 {
25
26 }
27
28}
29
我在它的page_load方法中写了如下字符
1private void Page_Load(object sender, EventArgs e)
2 {
3 this.HyperLink1.Text = "234";
4
5 }
2 {
3 this.HyperLink1.Text = "234";
4
5 }
当我用浏览器访问这个页面时,页面显示234,源代码如下
1
2
3<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
5<html xmlns="http://www.w3.org/1999/xhtml" >
6<head><title>
7 无标题页
8</title></head>
9<body>
10 <form name="form1" method="post" action="test.aspx" id="form1">
11<div>
12<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTEyNjc1NzA0NzMPZBYCAgMPZBYCAgMPDxYCHgRUZXh0BQMyMzRkZGTaa2ddQKFj2kvAyF7Ggg2s4PtnCA==" />
13</div>
14
15 <div>
16 <input type="submit" name="Button1" value="Button" id="Button1" /><br />
17 <a id="HyperLink1" href="login.aspx?ComeUrl=http://test..com.cn">234</a> </div>
18
19<div>
20
21 <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgK/8tW8CQKM54rGBsRRq6lpWEZCKO/SL9pRz44W3fDK" />
22</div></form>
23</body>
24</html>
25
2
3<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
5<html xmlns="http://www.w3.org/1999/xhtml" >
6<head><title>
7 无标题页
8</title></head>
9<body>
10 <form name="form1" method="post" action="test.aspx" id="form1">
11<div>
12<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTEyNjc1NzA0NzMPZBYCAgMPZBYCAgMPDxYCHgRUZXh0BQMyMzRkZGTaa2ddQKFj2kvAyF7Ggg2s4PtnCA==" />
13</div>
14
15 <div>
16 <input type="submit" name="Button1" value="Button" id="Button1" /><br />
17 <a id="HyperLink1" href="login.aspx?ComeUrl=http://test..com.cn">234</a> </div>
18
19<div>
20
21 <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgK/8tW8CQKM54rGBsRRq6lpWEZCKO/SL9pRz44W3fDK" />
22</div></form>
23</body>
24</html>
25
,但当我用prototype的 new Ajax.Request("test.aspx",{相关参数})来读取时,发现它读出的源代码竟然没有234,如下
读出来的源代码是
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
无标题页
</title></head>
<body>
<form name="form1" method="post" action="test.aspx" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTEyNjc1NzA0NzNkZOQVa4vKhp97DDEQEoO6wwXqNgJ8" />
</div>
<div>
<input type="submit" name="Button1" value="Button" id="Button1" /><br />
<a id="HyperLink1" href="login.aspx">HyperLink</a> </div>
<div>
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgLO2pDrDwKM54rGBiWg/jeI3Dj5CPRTiwsC64huUwbQ" />
</div></form>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
无标题页
</title></head>
<body>
<form name="form1" method="post" action="test.aspx" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTEyNjc1NzA0NzNkZOQVa4vKhp97DDEQEoO6wwXqNgJ8" />
</div>
<div>
<input type="submit" name="Button1" value="Button" id="Button1" /><br />
<a id="HyperLink1" href="login.aspx">HyperLink</a> </div>
<div>
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgLO2pDrDwKM54rGBiWg/jeI3Dj5CPRTiwsC64huUwbQ" />
</div></form>
</body>
</html>
他读出的html源代码不是动态的html源代码,好像后面的page_load方法就没有运行一样?这怎么回事?