Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 交叉页过账中的PreviousPage=null_Asp.net - Fatal编程技术网

Asp.net 交叉页过账中的PreviousPage=null

Asp.net 交叉页过账中的PreviousPage=null,asp.net,Asp.net,我试图将post数据从一页传递到下一页,但上一页总是等于null 这是我在原始页面(updatepanel内)中看到的内容 ) 知道为什么上一页总是等于null吗?返回使用服务器将控件发送到此页的页面。传输 如果当前页面是由于直接请求(不是来自另一页面的转移或交叉发布)而呈现的,则PreviousPage属性包含null 是的。。。它正在工作。。。当您使用button或linkbutton时,请使用postbackurl,不要使用response.redirect。当您使用postbackurl

我试图将post数据从一页传递到下一页,但上一页总是等于null

这是我在原始页面(updatepanel内)中看到的内容 )

知道为什么上一页总是等于null吗?

返回使用
服务器将控件发送到此页的页面。传输

如果当前页面是由于直接请求(不是来自另一页面的转移或交叉发布)而呈现的,则PreviousPage属性包含null


是的。。。它正在工作。。。当您使用button或linkbutton时,请使用postbackurl,不要使用response.redirect。当您使用postbackurl属性时,您可以使用控件来控制previou页面。。。请观看此视频以供参考

postbackurl和Response.Redirect之间的差异


PostBackURL将所有表单数据发送到指定的页面。而在使用响应时。将表单数据重定向到当前页面,然后将用户移动到指定页面

,因此使用按钮上的PostBackURL属性不是传输或交叉发布?正确。这将创建一个到不同页面的正常回发。那么如何从另一个页面创建交叉帖子?Request.Form不发送任何表单数据。“要使用跨页面发布,只需将PostBackUrl设置为另一个web表单的名称。当用户单击按钮时,页面将使用当前页面上所有输入控件的值发布到该新URL。”-CSharp第四版中的Pro asp.NET。我有点糊涂了@烘焙:和
请求。表单
将包含所有输入值。
<asp:Button ID="mmGo" runat="server" Text="Merge" PostBackUrl="~/Default2.aspx?action=merge"/>
<%@ 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>
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!";
    }
}