除了Url?
session
推荐使用url

解决方案 »

  1.   

    在页面1 用        url = "webform.aspx?"
            url2 = "aa=" + System.Web.HttpUtility.UrlEncode(TextBox1.Text) + ""
            url2 = url2 & "&bb=" + System.Web.HttpUtility.UrlEncode(TextBox2.Text) + ""
            url2 = url2 & "&ddl1=" + System.Web.HttpUtility.UrlEncode(DropDownList1.SelectedItem.Value) + ""
            url2 = url2 & "&ddl2=" + System.Web.HttpUtility.UrlEncode(DropDownList2.SelectedItem.Value) + ""
            url2 = url2 & "&ddl3=" + System.Web.HttpUtility.UrlEncode(DropDownList3.SelectedItem.Value) + ""
            url2 = url2 & "&ddl8=" + System.Web.HttpUtility.UrlEncode(DropDownList4.SelectedItem.Value) + ""
            url2 = url2 & "&ddl9=" + System.Web.HttpUtility.UrlEncode(DropDownList5.SelectedItem.Value) + ""
            url = url & url2
                 Response.Redirect(url)
    ————————————————————————————
    在页面2用request(System.Web.HttpUtility.UrlDecode(ddl1))request(System.Web.HttpUtility.UrlDecode(ddl2))request(System.Web.HttpUtility.UrlDecode(ddl3))request(System.Web.HttpUtility.UrlDecode(ddl4))request(System.Web.HttpUtility.UrlDecode(ddl5))
      

  2.   

    session怎么用呀?
    能介绍介绍吗?
    有没有相关文章 ?谢谢
      

  3.   

    传递时间短的话,Session会比较方便;
    不能确定传递时间,还是用QueryString或Cookies吧!
      

  4.   

    我估计你不是Url或是Session的问题,你的DropDownList是绑定的数据库还是自己添加的Item?有没有指定DropDownList的DataValueField?
      

  5.   

    ASP.NET WEB FORMS  给开发者提供了极好的事件驱动开发模式。然而这种简单的应用程序开发模式却给我们带来了一些小问题,举个例子,在传统的ASP应用程序中,你能够通过POST方法很容易的把一个值或多个值从一个页面传送到另一个页面,用同样的方法在ASP.NET中实现有点麻烦。在这里,我们可以通过其他方式来解决这种情形。ASP.NET为我们提供了三种方式,一种是可以通过用QueryString来传送相应的值,再一种是通过session变量来传送相应的值,还有就是通过Server.Transfer方法来实现。下面分别一一介绍:
    一、使用Querystring
    Querystring是一种非常简单的传值方式,其缺点就是会把要传送的值显示在浏览器的地址栏中,并且在此方法中不能够传递对象。如果你想传递一个安全性不是那么太重要或者是一个简单的数值时,用此方法最好不过了。下面通过一个小例子来完成传值工作,步骤如下:
    1、创建一个web form
    2、在新建的web form中放置一个button1,在放置两个TextBox1,TextBox2 
    3、为button按钮创建click事件
    代码如下:
    private void Button1_Click
    (object sender, System.EventArgs e)
    {
     string url;
     url="webform2.aspx?name=" + 
      TextBox1.Text + "&email=" + 
      TextBox2.Text;
     Response.Redirect(url);
    }
    4、新建一个目标页面命名为webform2
    5、在webform2中放置两个Label1,Label2
    在webform2的Page_Load中添加如下代码:
    private void Page_Load
    (object sender, System.EventArgs e)
    {
     Label1.Text=Request.QueryString["name"];
     Label2.Text=Request.QueryString["email"];
    }
    运行,即可看到传递后的结果了。二、使用Session变量使用Session变量传值是一种最常见的方式了,此中方式不仅可以把值传递到下一个页面,还可以交叉传递到多个页面,直至把Session变量的值removed后,变量才会消失。举个例子看看:
    1、创建一个web form
    2、在新建的web form中放置一个button1,在放置两个TextBox1,TextBox2 
    3、为button按钮创建click事件
    代码如下:
    private void Button1_Click
    (object sender, System.EventArgs e)
    {
            Session["name"]=TextBox1.Text;
     Session["email"]=TextBox2.Text;
     Response.Redirect("webform2.aspx");
    }
    4、新建一个目标页面命名为webform2
    5、在webform2中放置两个Label1,Label2
    在webform2的Page_Load中添加如下代码:
    private void Page_Load
    (object sender, System.EventArgs e)
    {
     Label1.Text=Session["name"].ToString();
     Label2.Text=Session["email"].ToString();
     Session.Remove("name");
     Session.Remove("email");
    }
    运行,即可看到传递后的结果了。三、使用Server.Transfer
    虽然这种方法有点复杂,但也不失为一种在页面传值的方式。
    举个例子看看:
    1、创建一个web form
    2、在新建的web form中放置一个button1,在放置两个TextBox1,TextBox2 
    3、为button按钮创建click事件
    代码如下:
    private void Button1_Click
    (object sender, System.EventArgs e)
    {
     Server.Transfer("webform2.aspx");
    }
    4、创建过程来返回TextBox1,TextBox2控件的值代码如下:
    public string Name
    {
     get
     {
      return TextBox1.Text;
     }
    }public string EMail
    {
     get
     {
      return TextBox2.Text;
     }
    }
    5、新建一个目标页面命名为webform2
    6、在webform2中放置两个Label1,Label2
    在webform2的Page_Load中添加如下代码:
    private void Page_Load
    (object sender, System.EventArgs e)
    {
     //创建原始窗体的实例
     WebForm1 wf1;
     //获得实例化的句柄
     wf1=(WebForm1)Context.Handler;
     Label1.Text=wf1.Name;
     Label2.Text=wf1.EMail;}
    运行,即可看到传递后的结果了。
      

  6.   

    1、Request的GET方法<form action="a.aspx" method="get">
    您的姓名:<input type="text" name="nickname"><br>
    <input type="submit" value="发送">
    <form>
    a.aspx.cs:
    string nickname=Request.QuerySring["nickname"];
    1、Request的POST方法
    <form action="a.aspx" method="post">
    您的姓名:<input type="text" name="nickname"><br>
    <input type="submit" value="发送">
    <form>
    a.aspx.cs:
    string nickname=Request.Form["nickname"];
      

  7.   

    已经不是变量能不能传递到目标页面的问题了我第二个页面已经得到了所有变量但除了TEXTBOX以外的 比如DOWNLOADLIST之类的变量无法用REQUEST得到郁闷呀
      

  8.   

    建议使用url  session虽然可以做到,,,可是就是不如url,,,这里涉及到session有效时间的问题,,,而url则不会了,,,再者,,,session用的象你那么多的变量,,,如果访问量大的话,,,还是那句话,,,你会死的很难看的哦,,,hoho!!!!!!!!!!!!!!!!!!
      

  9.   

    还有个小问题
    如何给DropDownList指定一个默认的 选择呢?
    就是 开始时的默认选择
      

  10.   

    出个不好的注意吧,,,你在第一页把例如downloadlist控件的具体值先得到,,,用个string类型的变量中转一下就可以了,,,呵呵
      

  11.   

    s添加一个属性,,,就是seleted属性就可以了啊我看看具体的代码怎么写,,,不知道你用什么工具开发.net
      

  12.   

    从数据库填充列表控件 (List Control) 将控件的 DataSource 属性设置为对页面的某个数据源的引用。 
    通过设置以下控件属性指定各列表项应分别用数据源中的哪些字段填充: 
    DataTextField 其值将显示在列表中的字段的名称。 
    DataTextFormatString 列表项文本的格式化表达式。 
    DataValueField 将用于各列表项 Value 属性的字段的名称。 
    如果数据源只有一个字段,则不必显式设置这些字段,因为控件将只显示这一字段。 
      

  13.   

    当前选定项可在 DropDownList 控件的 SelectedItem 属性中得到
      

  14.   

    接着阿风的说
    那里还有个 seleted属性的,,,选中就可以了
      

  15.   

    selected是已经选择的吧我意思是  我的LIST需要BIND一个数据源
    但我还需要加一个默认的无选择
    比如---请选择---   VALUES = “无选择”
    ---DATASET1--- 谢谢  谢谢
      

  16.   

    void Page_Load(Object Sender, EventArgs E) {            if (!IsPostBack) {               ArrayList values = new ArrayList();               values.Add ("IN");
                   values.Add ("KS");
                   values.Add ("MD");
                   values.Add ("MI");
                   values.Add ("OR");
                   values.Add ("TN");               DropDown1.DataSource = values;
                   DropDown1.DataBind();
                }
      

  17.   

    if (!IsPostBack) {               ArrayList values = new ArrayList();               values.Add ("---请选择---");
                   values.Add ("KS");
                   values.Add ("MD");
                   values.Add ("MI");
                   values.Add ("OR");
                   values.Add ("TN");               DropDown1.DataSource = values;
                   DropDown1.DataBind();
                }
      

  18.   

    我发现个郁闷问题呀我没办法把选择的直传递过来         Session("ddl1") = DropDownList1.SelectedItem.Value
            Session("ddl2") = DropDownList2.SelectedItem.Value
            Session("ddl3") = DropDownList3.SelectedItem.Value
            Session("ddl8") = DropDownList8.SelectedItem.Value
            Session("ddl9") = DropDownList9.SelectedItem.Value它传递过来的直不是 用户选择的 而是第一个 变量呀我要跳楼了
      

  19.   

    Question 1:you can use Request.Form["ddl1"] to get your value in page No.2  //in c#if you use vb.net,you may Request.Form("ddl1") to get the valueQuestion 2:  you can use selectvalue to realize it
      

  20.   


    可以使用Server.Transfer把一个页面提交给另一个页面来处理例如:a.aspx.cs中protected void btn1_Click(object sender,EventArgs e)
    {
      Server.Transfer("b.aspx",true);
    }
    b.aspx.cs中Page_Load(object sender,EventArgs e)
    {
    Response.Write(Request.Form["TextBox1"].ToString());    //TextBox1为a.aspx中的服务器控件
    }
      

  21.   

    不要郁闷了
    你把DropDownList值的绑定过程写在
    if (!IsPostBack) 
    {}
    就可以了
      

  22.   

    不要郁闷了
    你把DropDownList值的绑定过程写在
    if (!Page.IsPostBack) 
    {}
    就可以了
      

  23.   

    不要郁闷了
    你把第一个页面的DropDownList值的绑定过程写在
    if (!Page.IsPostBack) 
    {}
    就可以了
      

  24.   

    我的数据是用 DS BIND的如果要添加自定义 选择在哪添加呢 ?sql = "select sex,sex_id from sex_category"
            Dim dap4 As New OleDb.OleDbDataAdapter(sql, conn)
            Dim ds5 As New DataSet()
            dap4.Fill(ds5, "sex_category")        DropDownList1.DataSource = ds5
            DropDownList1.DataTextField = "sex"
            DropDownList1.DataValueField = "sex_id"
            DropDownList1.DataBind()        dap3 = Nothing
      

  25.   

    <asp:dropdownlist id="ddl_1" runat="server">
    <asp:listitem selected>无选择</asp:listitem>
    <asp;listitem>01</asp:listitem>
    </asp:dropdownlist>
      

  26.   

    呜呜呜呜呜呜呜呜呜呜呜呜呜呜----------------------------------------1  无法正确得到 DropDownList的 直
    2  无法指定一个默认的DropDownList选择
    3  无法从页面2的 QUERYSTRING的到 DropDownList的直 TEXTBOX都可以呀好象一切都是 DLIST的问题请大家帮帮忙呀
      

  27.   

    <asp:dropdownlist id="ddl_1" runat="server">
    <asp:listitem selected>无选择</asp:listitem>
    <asp;listitem>01</asp:listitem>
    </asp:dropdownlist>这个方法最笨  我早用过了没有用有没有办法 向 DATASET里面直接添加 一个ITEM呢?要具体代码哦
      

  28.   

    sql = "select sex,sex_id from sex_category"
            Dim dap4 As New OleDb.OleDbDataAdapter(sql, conn)
            Dim ds5 As New DataSet()
            dap4.Fill(ds5, "sex_category")        DropDownList1.DataSource = ds5
            DropDownList1.DataTextField = "sex"
            DropDownList1.DataValueField = "sex_id"
            DropDownList1.DataBind()       DropDownList1.Items.Insert(0,"---请选择---");
           DropDownList1.Items[0].Value = "nothing";
      

  29.   

    sql = "select sex,sex_id from sex_category"
            Dim dap4 As New OleDb.OleDbDataAdapter(sql, conn)
            Dim ds5 As New DataSet()
            dap4.Fill(ds5, "sex_category")        DropDownList1.DataSource = ds5
            DropDownList1.DataTextField = "sex"
            DropDownList1.DataValueField = "sex_id"
            DropDownList1.DataBind()       DropDownList1.Items.Insert(0,"---请选择---");
           DropDownList1.Items[0].Value = "nothing";
      

  30.   


    Sub Page_Load(sender As Object, e As EventArgs) 
                If Not IsPostBack Then               Dim values as ArrayList= new ArrayList()               values.Add ("01")
                   values.Add ("02")
                   values.Add ("03")               DropDown1.DataSource = values
                   DropDown1.DataBind
                End If
            End Sub
    第2个问:
    DropDown1.SelectedIndex=0(默认选项是第一项)
      

  31.   

    if(!Page.IsPostBack)
    {
            sql = "select sex,sex_id from sex_category"
            Dim dap4 As New OleDb.OleDbDataAdapter(sql, conn)
            Dim ds5 As New DataSet()
            dap4.Fill(ds5, "sex_category")        DropDownList1.DataSource = ds5
            DropDownList1.DataTextField = "sex"
            DropDownList1.DataValueField = "sex_id"
            DropDownList1.DataBind()       DropDownList1.Items.Insert(0,"---请选择---");
           DropDownList1.Items[0].Value = "nothing";
    }
      

  32.   

    还是有问题呀大家帮帮忙呀我无论选择DOWNLIST里面的任何 变量 它最后传递过来的直都是默认选择的
    是ITEM[0]郁闷呀
      

  33.   

    DropDownList的初始化语句放在了If not IsPostBack里了吗?
      

  34.   

    if(!Page.IsPostBack)
    {
            sql = "select sex,sex_id from sex_category"
            Dim dap4 As New OleDb.OleDbDataAdapter(sql, conn)
            Dim ds5 As New DataSet()
            dap4.Fill(ds5, "sex_category")        DropDownList1.DataSource = ds5
            DropDownList1.DataTextField = "sex"
            DropDownList1.DataValueField = "sex_id"
            DropDownList1.DataBind()       DropDownList1.Items.Insert(0,"---请选择---");
           DropDownList1.Items[0].Value = "nothing";
    }