ASP. net implements the method of page jump

  • 2020-06-07 04:24:44
  • OfStack

response attributes are mainly used. The code is as follows:


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);
        }// Of course, we can pass parameters when the page jumps. The code is as follows: 

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);
        }

Above is the code in one of my projects so there is item, which you can set according to your own situation.

Now that the parameters are passed, how do you get them in the skip page??

The code is as follows:


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;
            }
        }


Related articles: