Reputation: 1067
In my design there are three buttons. I want to open new windows on each button click. I have done upto open a new window. But when I click on the second button it opens in the same popup window. How can I avoid this and open three windows when click on these three buttons?
c# code
protected void btnApprove_Click(object sender, EventArgs e)
{
string ddlVal = ddlComp.SelectedValue.ToString();
if (ddlVal != "--Select The Competition--")
{
Session["ddlVal"] = ddlComp.SelectedValue.ToString();
ScriptManager.RegisterStartupScript(this, typeof(string), "APPROVE_WINDOW", "var Mleft = (screen.width/2)-(760/2);var Mtop = (screen.height/2)-(700/2);window.open( 'approved.aspx', null, 'resizable=yes, status=yes,toolbar=no,scrollbars=yes,menubar=no,location=no,top=\'+Mtop+\', left=\'+Mleft+\'' );", true);
}
else
{
WebMsgBox.Show("Select a competition");
}
}
This is the code I have used for all the three buttons with different page names
Upvotes: 1
Views: 1161
Reputation: 2621
You can pass the name parameter as '_blank' instead of null. Change the below line in your code
window.open( 'approved.aspx', null,
to
window.open( 'approved.aspx', '_blank',
Upvotes: 2
Reputation: 155418
If you're referring to top-level browser windows, you cannot - browsers disable this for obvious reasons (pop-up blockers, etc). You also cannot have more than one JavaScript alert()
window open at a time.
Your WebMsgBox
class wraps the alert()
function. So this not possible.
You will need to change your client-code to instead display multiple elements (e.g. absolutely-positioned <div>
boxes with a modal rectangular appearance).
Upvotes: 0