<form action=
<input name =
<input name =
</form>
form
此種方在ASP
接收頁面
發送頁面
按收頁面 string str = Session(
發送頁面
按收頁面
此種方法不常使用
Response
接收頁面
Server
接收頁面
二
以查詢數據頁面為例
在查詢頁面中設置如下公有屬性(QueryPage
public class QueryPage : System
{
protected System
protected System
/// <summary>
/// 開始時間
/// </summary>
public string StaDate
{
get{ return this
set{this
}
/// <summary>
/// 結束時間
/// </summary>
public string EndDate
{
get{ return this
set{this
}
private void btnEnter_Click(object sender
{
Server
}
}
在顯示查詢結果頁面(ResultPage
public class ResultPage : System
{
private void Page_Load(object sender
{
//轉換一下即可獲得前一頁面中輸入的數據
QueryPage queryPage = ( QueryPage )Context
Response
Response
Response
Response
}
}
三
在這種方式中關鍵在於
如果讓所有的查詢頁面都繼承一個接口
/// <summary>
/// 結果頁面中要用到的值
/// </summary>
public class QueryParams
{
private string staDate;
private string endDate;
/// <summary>
/// 開始時間
/// </summary>
public string StaDate
{
get{ return this
set{this
}
/// <summary>
/// 結束時間
/// </summary>
public string EndDate
{
get{ return this
set{this
}
}
/// <summary>
/// 定義查詢接口
/// </summary>
public interface IQueryParams
{
/// <summary>
/// 參數
/// </summary>
QueryParams Parameters{get;}
}
/// <summary>
///查詢頁面
/// </summary>
public class QueryPage : System
{
protected System
protected System
private QueryParams queryParams;
/// <summary>
/// 結果頁面用到的參數
/// </summary>
public QueryParams Parameters
{
get
{
return queryParams;
}
}
private void btnEnter_Click(object sender
{
//賦值
queryParams = new QueryParams();
queryParams
queryParams
Server
}
}
public class ResultPage : System
{
private void Page_Load(object sender
{
QueryParams queryParams = new QueryParams();
IQueryParams queryInterface;
//實現該接口的頁面
if( Context
{
queryInterface = ( IQueryParams )Context
queryParams = queryInterface
}
Response
Response
Response
Response
}
}
From:http://tw.wingwit.com/Article/program/net/201311/11562.html