在ASP.NET中如何传递上一页面的控件值,该控件是我在Page_load事件中创建的,但又要在下一页引用到该控件的属性值,不知道怎么办才好。大家帮帮忙吧!

解决方案 »

  1.   

    window.opener.document.all.controlname.value
      

  2.   

    好像没有Window这个方法啊。我用的是.net2003的
      

  3.   

    viewstateviewstate能够保存控件值和控件ID
    还可以通过webconfig的设置对其值进行加密
      

  4.   

    Response.Redirect("上一个页面.aspx?ID ="+你的控件名.Text);
    在下一页使用Request["ID"],就得到传过来的值得了。如:Response.Redirect("Main.aspx?Name ="+this.txtName.Text);
        string strName = Request["Name"]
      

  5.   

    更正一下,Response.Redirect("下一个页面.aspx?ID ="+你的控件名.Text);即你要跳转过去的页面。
      

  6.   

    本网页中
    Response.Redirect("Main.aspx?Name ="+this.txtName.Text);在Main.aspx页面的Page_load事件里用
    Request.QueryString["Name"].ToString() 
    来接收
      

  7.   

    常用的方法有两种
    Response.Redirect("yourPageName?yourFieldName"+yourConrtols.Text.Tostring())在你的yourPageName页使用Request.QueryString["yourFieldName"].ToString()2:Session["yourFieldName"]=yourFiledName.Text.ToString();在你想用这个值的页面中String yourFieldName=Session["yourFieldName"].ToString();
      

  8.   

    把控件属性放在URL查询参数中、COOKIES中、后台数据库里面、Session中,想存个数据总是有办法的,然后另一个页面去读取就可以了。
      

  9.   

    俺是初学者。不知道我样做法对不对。代码如下:
    For j = 0 To rst2.RecordCount - 1
                        Application.Set(("rcount"), Application("rcount") + 1)
                        Response.Write("<tr>")
                        For t = 0 To rst2.Fields.Count - 1
                            If t = 0 Then
                                Response.Write("<td align=center  height=15px bgcolor=#3399cc> " & "<a href=webform1.aspx target=_blank>" & "<font face=宋体 size =2px>" & rst2(t).Value & "</font>" & "</td>")
                            Else
                                Response.Write("<td align=center  height=15px bgcolor=#3399cc> " & "<font face=宋体 size =2px>" & rst2(t).Value & "</font>" & "</td>")
                            End If
                            If t = 1 Then
                                Response.Write("<td align=center width=5% height=15px bgcolor=#3399cc>")
                                Response.Write("<input type=checkbox name=c & " & rcount & " value=on runat=server id=checkbox>")
                                Response.Write("</td>")
                            End If
                        Next
                        Response.Write("</tr>")
                        rst2.MoveNext()
                    Next
                    rst.MoveNext()
                Next
      

  10.   

    俺是初学者。不知道我样做法对不对。代码如下:    Response.Write("<input type=checkbox name=c & " & rcount & " value=on >")
        Response.Write("</td>
                        Response.Write("</tr>")
                        rst2.MoveNext()
                    Next
                    rst.MoveNext()
                Next
      

  11.   

    上面发了两次都是不对的,这次是我想要说的。俺是初学者不知道我样做法对不对。代码如下:
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            '在此处放置初始化页的用户代码
        for i=0 to 10    
           <table border=0 framebox height=100% widht=100%>
           <tr>
           Response.Write("<td>")
           Response.Write("<input type=checkbox name=c & " & i & " value=on >")
           Response.Write("</td>")
          </tr>
          </table>
        next
    end sub
    我的意思是:在下一页中判断那11个checkbox有几个被选中了,不知该怎么做?
    大家说我这样做对不对?
      

  12.   

    Server.Transfer("下一页面.aspx", True)
      

  13.   

    7楼正解,
    此为JAVASCRIPT脚本写法:
    传递参数window.open("WebForm5.aspx?text="+value),"newwindow","toolbar=yes,width=600,height=600,top="+(screen.height-600)/2+",left="+(screen.width-600)/2+";,directories=no,status=yes,scrollbars=yes,resizable=yes,menubar=yes");
      

  14.   

    好像都不行啊。还有没有更好的办法?我用的是VB.NET2003的,又是初学各不妨说仔细点,最好举个例子。
      

  15.   

    本网页中
    Response.Redirect("Main.aspx?Name ="+this.txtName.Text);在Main.aspx页面的Page_load事件里用
    Request.QueryString["Name"].ToString() 
    来接收
      

  16.   

    我是在Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 事件里面定义的变量,如下:Response.Write("<input type=checkbox name=c1 & " value=on >")
    我用Response.Redirect("Main.aspx?Name ="+c1)用不了。不知该怎么办好。
      

  17.   

    更正一点Response.Write("<input type=checkbox name=c1 & " value=on >")没有&的
    Response.Write("<input type=checkbox name=c1" value=on >")说是c1没有定义
      

  18.   

    四种种方法:
    1.ViewState;
    2.cookie;
    3.session;
    4.url传值;
    你的情况用第3,第4种比较方便。
      

  19.   

    用Session会好些.也可以用Response.Redirect("URL查询串")