tuncaysanli

其中Button1 是一个html服务器控件,为了实现点击Button1实现页面的跳转(跳转到同一母页模板的另一页面,看了 Button1_onclick()就明白些了,同时跳转时母版页面不像web控件那样刷新),同时实现页面之间值的传递。

1、在后台的一个页面(传值页面)的cs代码:

               Session["name"] = this.Label1.Text;
                Session["Character"] = this.Label5.Text;

          Button1.Attributes.Add("onclick", "Button1_onclick();");

2、前台js代码:

<script language="javascript" type="text/javascript">
<!--

function Button1_onclick()

{
 frm.location.href=\'http://localhost:4569/我的消息/系统消息.aspx\'
  
   var   str1,str2;  
      str1 ="<%=Session["name"].ToString()%>";  
     str2="<%=Session["Character"].ToString()%>";


}

 -->
</script>

3、在后台的另外一个页面(接收值页面)的cs代码:

 string name = Session["name"].ToString();
            string character = Session["Character"].ToString();

分类:

技术点:

相关文章:

  • 2021-12-09
  • 2022-12-23
  • 2022-02-03
  • 2021-11-06
  • 2022-02-19
  • 2022-01-14
  • 2022-01-14
  • 2022-12-23
猜你喜欢
  • 2021-12-23
  • 2021-11-27
  • 2021-11-20
  • 2021-03-31
  • 2021-12-07
  • 2021-12-15
相关资源
相似解决方案