当前位置:编程学习 > C#/ASP.NET >>

大大们!老问题多页面给一个页面传值!!!细看下哟

--------------------编程问答-------------------- 你想问什么 --------------------编程问答-------------------- 帮顶下。。。 --------------------编程问答--------------------
引用 1 楼 sandy945 的回复:
你想问什么

用Response.Write("<form   id='form2'   name='form2'   action='Detail.aspx'   method='post'>");
        Response.Write("<input   name='idvalue' id='idvalue'  type='text'  value='" + idvalue + "' style='display:none;'>");
        Response.Write("</form>");
        Response.Write("<script>");
        Response.Write("document.form2.submit();");
        Response.Write("</script>");  
跳转后没办法使用后退键。。。  --------------------编程问答-------------------- 不明白楼主到底要问什么,可否说详细一些 --------------------编程问答-------------------- 实现在就行,post 应该是最好的了啊 --------------------编程问答--------------------
引用 1 楼 sandy945 的回复:
你想问什么
--------------------编程问答-------------------- 1、post跳转后退键肯定是有的。
2.用js动态和成form来post.
--------------------编程问答-------------------- 支持慕白兄

1、post跳转后退键肯定是有的。 
2.用js动态和成form来post.  --------------------编程问答--------------------
引用 7 楼 cpp2017 的回复:
1、post跳转后退键肯定是有的。
2.用js动态和成form来post.

A.aspx传值到B.aspx

(1)A.aspx的Gridview1.select事件
protected void Gridview1_SelectedIndexChanged(object sender, EventArgs e)
    {
        string idvalue="1234";
        Response.Write("<form   id='form2'   name='form2'   action='Detail.aspx'   method='post'>");
        Response.Write("<input   name='idvalue' id='idvalue'  type='text'  value='" + idvalue + "' style='display:none;'>");
        Response.Write("</form>");
        Response.Write("<script>");
        Response.Write("document.form2.submit();");
        Response.Write("</script>");  
        
    }


(2) 跳转到B.aspx
 protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

       string idvalue=Request.Form["idvalue"].ToString();  //可以取到值,但在B.aspx上跳浏览器的“后退键”,跳到A.aspx但又马上自动跳到B.aspx了。如何不跳回B.aspx
            }
}
--------------------编程问答-------------------- 重新加载A页面
var form1= document.createElement("form");
    document.body.appendChild(form1);    
    var i = document.createElement("input");
    i.type = "hidden";
    i.name = "Title";
    form1.appendChild(i);
    var j=document.createElement("input");
    j.type="hidden";
    j.name="Content";
    form1.appendChild(j);

    var hiddenIframe=document.createElement("iframe");
    hiddenIframe.src="about:blank";
    hiddenIframe.name="hiddenFrame";
    hiddenIframe.id="hiddenFrame";
    hiddenIframe.width="0";
    hiddenIframe.height="0";
    hiddenIframe.frameborder="0";
    form1.appendChild(hiddenIframe);
    form1.action = "";
    form1.target = "hiddenFrame";
    form1.method = "post";
    form1.submit(); --------------------编程问答-------------------- up................................. --------------------编程问答--------------------

HttpCookie hc = new HttpCookie("temp", "2");
        hc.Expires = DateTime.Now.AddSeconds(3);
        Response.Cookies.Add(hc);



        string idvalue = "1234";
        Response.Write("<form   id='form2'   name='form2'   action='RepeaterTreeView.aspx'   method='post'>");
        Response.Write("<input   name='idvalue' id='idvalue'  type='text'  value='" + idvalue + "' style='display:none;'>");
        Response.Write("</form>");
        Response.Write("<script>");

        string js=@"function getCookie(objName) {//获取指定名称的cookie的值
            var arrStr = document.cookie.split('; ');
            for (var i = 0; i < arrStr.length; i++) {
                var temp = arrStr[i].split('=');
                if (temp[0] == objName) return unescape(temp[1]);
            }
        }";

        Response.Write(js);

        Response.Write("if(getCookie('temp')){document.form2.submit();}");
        Response.Write("</script>");  
--------------------编程问答-------------------- 学习。。。。。。。。
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,