C# asp.net通过传递查询字符串在SelectedIndex上的下拉列表的“新建”选项卡中重定向页面

C# asp.net通过传递查询字符串在SelectedIndex上的下拉列表的“新建”选项卡中重定向页面,c#,javascript,asp.net,C#,Javascript,Asp.net,这是我的密码。请帮助我在新选项卡中重定向页面。 它可以是脚本或c代码。 提前谢谢 <asp:DropDownList ID="ddlcomplaint" CssClass="list-item-width1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlcomplaint_SelectedIndexChanged" onchange="asp

这是我的密码。请帮助我在新选项卡中重定向页面。 它可以是脚本或c代码。 提前谢谢

 <asp:DropDownList ID="ddlcomplaint" CssClass="list-item-width1" runat="server"  AutoPostBack="true" 
                                OnSelectedIndexChanged="ddlcomplaint_SelectedIndexChanged" onchange="aspnetForm.target ='_blank';">



protected void ddlcomplaint_SelectedIndexChanged(object sender, EventArgs e)
    {
        txtTitle.Text = "";
        int complaint = Convert.ToInt16(ddlcomplaint.SelectedValue);
        if (complaint == 100)
        {
            txtTitle.Enabled = true;

        }
        else
        {
            txtTitle.Enabled = true;
            txtTitle.Text = ddlcomplaint.SelectedItem.Text.ToString();

        }
        string Title = ddlcomplaint.SelectedItem.Text;

        Response.Redirect("/SearchComplaint.aspx?Title=" + Title);



    }

受保护的无效DDL\u选择的索引已更改(对象发送方,事件参数e)
{
txtTitle.Text=“”;
int投诉=转换为NT16(DDLCompation.SelectedValue);
如果(投诉==100)
{
txtTitle.Enabled=true;
}
其他的
{
txtTitle.Enabled=true;
txtTitle.Text=ddl.SelectedItem.Text.ToString();
}
string Title=ddl.SelectedItem.Text;
Response.Redirect(“/SearchComplaint.aspx?Title=“+Title”);
}

JavaScript

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript">
        function Redirect() {
            var ddl1 = document.getElementById('<%= ddlcomplaint.ClientID %>');
            var selectedval = ddl1.options[ddl1.selectedIndex].value;
            window.open("/SearchComplaint.aspx?Title=" + selectedval );
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:DropDownList ID="ddl1" runat="server" onchange="Redirect();">
    </asp:DropDownList>
    </div>
    </form>
</body>
</html>

Response.Redirect(“javascript:window.open(/SearchComplaint.aspx?Title=“+Title));JavaScript正在工作。但它正在当前选项卡中重定向。我想要新的标签。帮帮我,你告诉我javascript正在工作,但是在同一个页面中导航。所以我更改了javascript代码。你能看到吗?我添加了window.location.href而不是window.open.Use this,它会工作的。我使用了window.open。但是,它不工作。有其他方法吗?如果我使用window.open,它甚至不会在同一页面中重定向。我不知道问题在哪里:(
protected void ddl1_SelectedIndexChanged(object sender, EventArgs e)
    {
        ClientScript.RegisterStartupScript(this.GetType(),"OpenWindow","window.open('/SearchComplaint.aspx?Title=" + Title');",true);
    }