ASP.NET十分有用的页面间传值方法

时间:2007-07-20 10:06:53  来源:站长资讯收集整理  作者:佚名

4、别外的页面也如此设置
5、接收页面(ResultPage.aspx):


public class ResultPage : System.Web.UI.Page
{
   private void Page_Load(object sender, System.EventArgs e)
   {

QueryParams queryParams = new QueryParams();
IQueryParams queryInterface;
//实现该接口的页面
if( Context.Handler is IQueryParams)
{
queryInterface = ( IQueryParams )Context.Handler;
queryParams = queryInterface.Parameters;
}

Response.Write( "StaDate:" );
Response.Write( queryParams.StaDate );
Response.Write( "<br/>EndDate:" );
Response.Write( queryParams.EndDate );
  }
}

 

  
三、本文起因:
      因在工作中要作一个数据查询,参数烦多,原先是用Session传递,用完该Session传来的参数后,还需清理Session,在用Session之前还得判断该Session是否存在,极其烦琐,我想应该还有更简便的方法来实现页面间的参数传递,内容来自中国站长资讯网(www.chinahtml.com)故上网查找,终于找到这样一种方式来实现页面间的参数传递。   ( 负责编辑:kaso )

文章评论

共有 位CH网友发表了评论 查看完整内容