-2

我想在我的第一页按钮单击事件中通过按钮单击来执行此操作:

If (ddlistX.SelectedItem = "1" And Some Hober button is selected )

导航到页面 p1、p3(限制 p2)

If (ddlistX.SelectedItem = "2" And Some Hober button is selected )

导航到页面 p1 和 p2

别的

消息“您的选择丢失”

任何帮助将不胜感激

4

2 回答 2

0
if (ddlistX.SelectedItem = "1" And Some Hober button is selected)
{
Session["Restrictp2"]=="Yes";
Response.Redirect(p1);
//Navigate to page p1, p3 (restrict p2)
}
else if (ddlistX.SelectedItem = "2" And Some Hober button is selected)
{
Session["Restrictp2"]=="No";
Response.Redirect(p1);
Navigate to page p1 and p2
}
else
{
ErrorLabel.Text= "Your selection is missing ";
}

在您的 p3 代码隐藏 Page_Load 中,执行此操作

if(Session["Restrictp2"].toString=="Yes")
{
Response.Redirect("home.aspx");
}
于 2012-06-26T10:42:55.863 回答
-1

(这是对 Ashwin 答案的修改)

嘿再次:我有主页,p2,p3 页面。条件 1 导航:主页>p3 条件 2 导航:主页>p2>p3

//条件1

if (ddlistX.SelectedItem == "1" And ddlistY.SelectedItem == "a")
      { Session["p2.aspx"]=="True"; 
      Response.Redirect("p3.aspx"); //Navigate to page p3 and restrict p2 } 

//条件2

  else if (ddlistX.SelectedItem = ="2" ddlistY.SelectedItem == "b")
        { 
           Session["p2.aspx"]=="False"; 
          Response.Redirect(p2.aspx); Navigate to page p1 and p2 } 

//我用postbackurl从p2导航到p3

else { ErrorLabel.Text= "Your selection is missing "; } 

在您的 p2 代码隐藏 Page_Load 中,执行此操作

if(Session["p2.aspx"]=="Yes") 
 { Response.Redirect("home.aspx"); } 
于 2012-06-27T08:30:39.117 回答