protected void RedirectToLink_SelectedIndexChnaged(object sender, EventArgs e)
{
if (ddlOtherWebsites.SelectedIndex != -1)
{
//Im using this code but it gives a Popup window alert to Allow it to open.
//I want an alternative to it so that i dont have to click allow everytime.
DataTable dt = db.getDataTable("select * from otherwebsites where Status='1'
and id=" + ddlOtherWebsites.SelectedValue.ToString());
if (dt != null && dt.Rows.Count > 0)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow",
"window.open('" + dt.Rows[0]["shortdescp"].ToString() + "','_newtab');",true);
}
}
}
答案 0 :(得分:1)
没有像_newtab或_tab这样的可用选项。您需要使用_blank打开一个新标签。
protected void RedirectToLink_SelectedIndexChnaged(object sender, EventArgs e)
{
if (ddlOtherWebsites.SelectedIndex != -1)
{
DataTable dt = db.getDataTable("select * from otherwebsites where Status='1' and id=" + ddlOtherWebsites.SelectedValue.ToString());
if (dt != null && dt.Rows.Count > 0)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow", "window.open('" + dt.Rows[0]["shortdescp"].ToString() + "','_blank');",true);
}
}
}