Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
Hi friends,

I am facing some browser issue while opening the new tab on buttonclick after condition is checked.
C#
protected void btnPrint_Click(object sender, EventArgs e)
{
    DataTable dt = ....;
    if (dt.Rows.Count != 0)
    {                
        string redirect = "<script>window.open('some other page');</script>";
        Response.Write(redirect);
    }
    else
    {
        this.ClientScript.RegisterStartupScript(this.GetType(), "Startupalert", "alert('No details to show');", true);
    }
}


as it is working fine with Firefox and IE but not in Chrome...
Can any one please give some suggestions????
Posted
v4

1 solution

window.open is javascript method and all major browser (including crome) it is supported. It you see w3school site you will be more clear.
WINDOW OPEN[^]

I tried with your code and it is working in my site.

I guess from your crome browser's popup window is blocked from browser settings. If you enable popup from your browser then hopefully it will work.

for change crome browser popup window settings
https://support.google.com/chrome/answer/95472?hl=en[^]
 
Share this answer
 
v2
Comments
ridoy 4-Nov-13 3:13am    
I also think so,good suggestion regarding browser settings.
S. M. Ahasan Habib 4-Nov-13 10:50am    
thanks!
Charan_Kumar 6-Nov-13 1:22am    
hi habib,
i know it is showing in popup, but as a user side it is an issue...??!!!
S. M. Ahasan Habib 6-Nov-13 2:46am    
It might be user browser setting issue. So i suggest to request client to check his browser setting regarding popup display.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900