System Information

Impossible Is Nothing...

导航

Server.Transfer例子

必须使用Server.Transfer
具体代码如下(请仔细对比页面名称的变化):
要传递值的页面asm_content_view.aspx
/// <summary>
/// 搜索值
/// </summary>
public string strText
{
  get
  {
    return(this.txtsearch.Text);
  }
}

/// <summary>
/// 搜索类型
/// </summary>
public string strType
{
  get
  {
    return(this.listsearch.SelectedValue);
  }
}

/// <summary>
/// 搜索
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void butsearch_Click(object sender, System.EventArgs e)
{
  this.Server.Transfer("asm_content_list.aspx");
}


要接收的页面
//查看有无从asm_content_view页面转来的搜索对象
string strname = Context.Handler.ToString().ToLower();
if( strname == "asp.asm_content_view_aspx")
{
  mydata.content.page.asm_content_view myform = new asm_content_view();        
  myform = (mydata.content.page.asm_content_view)Context.Handler;
  this.txtsearch.Text = myform.strText;
  this.listsearch.SelectedValue = myform.strType;
}

posted on 2005-07-06 14:20  SysInfo  阅读(1160)  评论(2编辑  收藏  举报