所以我注意到,如果我的 SOURCE 页面在 asp:Content 块(母版页)中有 TextBox 等,则 PreviousPage 和 Request.Form 不起作用
有解决方法还是我不明白什么?
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" MasterPageFile="Menu.master" %>
<asp:Content ID="pageHead" ContentPlaceHolderID="pageHead" Runat="Server">
<title>Whatever</title>
</asp:Content>
<asp:Content ID="pageContent" ContentPlaceHolderID="pageContent" Runat="Server" >
<asp:TextBox runat="server" ID="txtTester" Text="YES"></asp:TextBox>
<asp:Button runat=server ID="btnTest" PostBackUrl="~/Process.aspx" />
</asp:Content>
目标代码隐藏:
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ltlDebug.Text = Request.Form["txtTester"];
//Doesn't get the var, only if I remove it from master page model in source page
}
}