主要是使用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;
}
}