访问前一页控件值

Access previous page controls value

本文关键字:控件 一页 访问      更新时间:2023-09-26

我有一个问题,我想访问以前页面值的控件。我知道我可以使用postbackurl,但我必须使用OnClientClick属性,因为我必须调用javascript方法,并根据标准我的url更改。下面的方法被称为OnClientClick属性。此页面名为Calculator.aspx

        function redirectSellPage() {
        var type = getParameterByName('type');

        if (type == 'test') {
            window.location.href = "Change.aspx?PageType=a";
        } else if (a == null || a == "") {
            window.location.href = "Change.aspx?PageType=b";
        } else {
            window.location.href = "Change.aspx?PageType=c";
        }

    }

我想访问计算器。aspx控制Change.aspx中的值。

在源页面中,在您的示例中是Calculator。在Aspx中添加:

public String Value1
{
get
{
    return YourTextBoxId.Text;
}
}

在目标页面上,在您的示例中是Change。在aspx中,添加一个@ PreviousPageType页面指令,指向源页面。

<%@ PreviousPageType VirtualPath="~/Calculator.aspx" %>

现在在目标页中使用previoupage属性来访问值。

String val = PreviousPage.Value1;