相思资源网 Design By www.200059.com

主要是使用response的属性,代码如下:
复制代码 代码如下:
protected void LinkButton1_Click(object sender, EventArgs e)
        {
            string url = "InfoShow.aspx";
            Response.Redirect(url);
        }

protected void LinkButton1_Click(object sender, EventArgs e)
        {
            string url = "InfoShow.aspx";
            Response.Redirect(url);
        }//当然我们可以在页面跳转的时候进行参数传递,代码如下:


protected void Menu1_MenuItemClick(object sender, MenuEventArgs e)
       {
           string url, s;
           s = e.Item.Value.ToString();
           url = "InfoRelease.aspx?UserName=" + s.Trim();
           Response.Redirect(url);
       }

 protected void Menu1_MenuItemClick(object sender, MenuEventArgs e)
        {
            string url, s;
            s = e.Item.Value.ToString();
            url = "InfoRelease.aspx?UserName=" + s.Trim();
            Response.Redirect(url);
        }
 
上面是我的一个项目中的代码所以有item,大家可以根据自己的情况进行设定。

那么既然传递了参数,在跳转的页面怎样获取呢???

代码如下:

复制代码 代码如下:
protected void Page_Load(object sender, EventArgs e)
       {
           if (Request["UserName"] != null)
           {
               string s = Request["UserName"].ToString();
    //           form1.Visible = true;
               txtInfoclass.Text = s;
           }
       }

 protected void Page_Load(object sender, EventArgs e)
        {
            if (Request["UserName"] != null)
            {
                string s = Request["UserName"].ToString();
     //           form1.Visible = true;
                txtInfoclass.Text = s;
            }
        }


复制代码 代码如下:
protected void Page_Load(object sender, EventArgs e)
       {
           txtAlert.Text = "";
           if (Request["UserName"] != null)
           {
               string s = Request["UserName"].ToString();
    //           form1.Visible = true;
               txtInfoclass.Text = s;
           }
       }

 protected void Page_Load(object sender, EventArgs e)
        {
            txtAlert.Text = "";
            if (Request["UserName"] != null)
            {
                string s = Request["UserName"].ToString();
     //           form1.Visible = true;
                txtInfoclass.Text = s;
            }
        }

标签:
页面,跳转

相思资源网 Design By www.200059.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
相思资源网 Design By www.200059.com

评论“ASP.net实现页面跳转的方法”

暂无ASP.net实现页面跳转的方法的评论...