我的前台是这样写的:
<asp:DropDownList ID="DropDownList1" runat="server" Width="200"  AutoPostBack="true" 
        onselectedindexchanged="DropDownList1_SelectedIndexChanged">
        <asp:ListItem Value="111.aspx">111</asp:ListItem>
        <asp:ListItem Value="222.aspx">222</asp:ListItem>
        <asp:ListItem Value="333.aspx">333</asp:ListItem>
    </asp:DropDownList>
后台是:
 protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {        
        Response.Redirect(DropDownList1.SelectedValue);
    }
但是代码实现不了我想要的工能。请哪个高手指点一下

解决方案 »

  1.   

    AutoPostBack="true"
    DropDownList1.SelectedItem.Text
      

  2.   


    日 人家有你在value中写 value=1在cs中if(value==1){跳转页面}
      

  3.   

    改这样:
    <asp:DropDownList ID="DropDownList1" runat="server" Width="200" AutoPostBack="true"
        OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
        <asp:ListItem Value=""> - 请选择 - </asp:ListItem>
        <asp:ListItem Value="111.aspx">111</asp:ListItem>
        <asp:ListItem Value="222.aspx">222</asp:ListItem>
        <asp:ListItem Value="333.aspx">333</asp:ListItem>
    </asp:DropDownList>protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (DropDownList1.SelectedIndex > 0)
            Response.Redirect(DropDownList1.SelectedItem.Text);
    }
      

  4.   

    楼主有问题 ? 代码是正确的啊,可以那样写啊,我也试了的,可以实现楼主要的跳转功能啊。
     <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" 
                onselectedindexchanged="DropDownList1_SelectedIndexChanged">
                <asp:ListItem Value="aa.aspx">aa</asp:ListItem>
                <asp:ListItem Value="Default.aspx">default</asp:ListItem>
                <asp:ListItem Value="bb.aspx">bb</asp:ListItem>
            </asp:DropDownList>
        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            Response.Redirect(DropDownList1.SelectedValue);
        }  
      

  5.   

    后台这样也行:
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (DropDownList1.SelectedIndex > 0)
            Response.Redirect(DropDownList1.SelectedValue);
    }
      

  6.   

    Response.Redirect(DropDownList1.SelectedValue.Trim());
    好像没啥问题吧
      

  7.   

    下拉列表中一直的选项一直是 <asp:ListItem Value="111.aspx">111</asp:ListItem>
    不管跳转到那都都是的。
      

  8.   

    只有这个不一样,
    <asp:ListItem Value="111.aspx">111</asp:ListItem>
    改成
    <asp:ListItem Value="111.aspx" Text="111"></asp:ListItem>
      

  9.   

    还有如果要Value,用SelectedItem.Value
      

  10.   

    Response.Redirect(DropDownList1.SelectedValue);
    改成Response.Redirect(""+DropDownList1.SelectedValue+"");
      

  11.   

    更正,还是要设autopostback=true,
    但是,每个页面要设dropdownlist的默认值
      

  12.   

    也就是说,无论如何,在每个页面上,那个下拉列表的默认的Item都是自己的那一项
      

  13.   

    例如111.aspx中,
    protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                ///其他页面以此类推
                this.DropDownList1.SelectedIndex = 0;
            }
        }
      

  14.   

    这样操作完全可以不需要autopost到后台用Response重定位的,直接用js在onchange里写href.location=来做就行了。
      

  15.   

    LZ是不是每一个页面都有这个相同的DROPDOWNLIST?
    那在Page_Load事件函数里要设置在当前页的DROPDOWNLIST应该显示哪一个选项
    比如在222.aspx
    那么就加上
    this.DropDownList1.SelectedIndex =1;