locked
window not being resized.... RRS feed

  • Question

  • User-153404742 posted

    Hi,

    I have a gridview control with link, which opens new window.....however, the height and width I pass in doesn't seem to be taking affect.  Below is my code:

    LinkButton lnk = (LinkButton)e.Row.FindControl("lnkNewPage");

     if (lnk != null)
                                    {
                                        lnk.Visible = true;
                                        string url = "NewPage.aspx?ID=" + myID.ToString();
                                      lnk.Attributes.Add("onClick", "JavaScript: window.open('" + url + "','','_blank','toolbar=no,menubar=no,width=250,height=125,left=250,top=300')");
     
                                       
                                    }
    why is the window always opening one height and width no matter what I specify in the window.open properties?
    Tuesday, October 23, 2018 9:30 PM

All replies

  • User2103319870 posted

    inkaln

    lnk.Attributes.Add("onClick", "JavaScript: window.open('" + url + "','','_blank','toolbar=no,menubar=no,width=250,height=125,left=250,top=300')");

    Remove the extra double quotes and the code will work as expected

     LinkButton lnk = (LinkButton)e.Row.FindControl("lnkNewPage");
                    if (lnk != null)
                    {
                        lnk.Visible = true;
                        string url = "NewPage.aspx?ID=" + myID.ToString();
                        lnk.Attributes.Add("onClick", "JavaScript: window.open('" + url + "','_blank','toolbar=no,menubar=no,width=250,height=125')");
                    }

    Wednesday, October 24, 2018 12:08 AM
  • User-153404742 posted

    the addressbar doesn't hide....i'm uisng 

    location=no,toolbar=no,menubar=no
    Friday, October 26, 2018 10:10 PM
  • User839733648 posted

    Hi inkaln,

    inkaln

    the addressbar doesn't hide

    Hiding the address bar is no longer possible in modern browsers due to security restrictions.

    You could not remove the address bar in modern browsers.

    The user must always know what page they are on.

    Address bar also let user know, what type of security is on that page (HTTP or HTTPS).

    For more about this, you could refer to the link: Window .open()

    Best Regards,

    Jenifer

    Monday, October 29, 2018 5:53 AM