技术开发 频道

Asp.net页面之间如何大量的传送参数

  一个页面接受多个页面传递的参数,对结果统一处理

  1.新建参数类及接口

  /**////

  
///QueryParams 的摘要说明

  
///

  
public class QueryParams

  {

  
private string staDate;

  
private string endDate;

  
/**////

  
/// 开始时间

  
///

  
public string StaDate

  {

  
get { return this.staDate; }

  
set { this.staDate = value; }

  }

  
/**////

  
/// 结束时间

  
///

  
public string EndDate

  {

  
get { return this.endDate; }

  
set { this.endDate = value; }

  }

  }

  
/**////

  
/// 定义查询接口。

  
///

  
public interface IQueryParams

  {

  
/**////

  
/// 参数

  
///

  QueryParams Parameters{
get;}

  }

  2.多个页面中要继承该接口

  public partial class Default3 : System.Web.UI.Page,IQueryParams

  {

  
private QueryParams param;

  
public QueryParams Parameters

  {

  
get

  {

  
return param;

  }

  }

  
protected void Page_Load(object sender, EventArgs e)

  {

  }

  
protected void Button1_Click(object sender, EventArgs e)

  {

  param
= new QueryParams();

  param.StaDate
= this.TextBox1.Text.ToString();

  param.EndDate
= this.TextBox2.Text.ToString();

  Server.Transfer(
"Default4.aspx");

  }

  }
0
相关文章