我试图将张贴的数据从一页传递到下一页,但上一页总是等于空。PreviousPage =空的跨页张贴
这是我在原来的页面
<asp:Button ID="mmGo" runat="server" Text="Merge" PostBackUrl="~/Default2.aspx?action=merge"/>
然后在下面的网页我有(一个UpdatePanel 内):
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<%@ PreviousPageType VirtualPath="~/Default.aspx" %>
<!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 runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
...并在cs文件:
protected void Page_Load(object sender, EventArgs e)
{
if (PreviousPage != null)
{
string action = Request.QueryString["action"];
if (action == "merge")
{
UpdatePanel SourceControl = (UpdatePanel)PreviousPage.FindControl("UpdatePanel1");
HiddenField SourceTextBox = (HiddenField)SourceControl.FindControl("txtListIDs");
if (SourceTextBox != null)
{
Label1.Text = SourceTextBox.Value;
}
}
}
else
{
Label1.Text = "page is not cross page post back!";
}
}
任何想法为什么PreviousPage总是等于null?
因此,在按钮上使用PostBackURL属性不是传输或交叉邮件吗? – baked 2011-02-07 14:43:55