Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6213759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:45:18+00:00 2026-05-24T06:45:18+00:00

This is my code protected void LoginButton_Click(object sender, EventArgs e) { if (DAL.DAOKullanici.Login(KullaniciTextBox.Text,SifreTextBox.Text)) {

  • 0

This is my code

protected void LoginButton_Click(object sender, EventArgs e)
    {
        if (DAL.DAOKullanici.Login(KullaniciTextBox.Text,SifreTextBox.Text))
        {
            VeriyazPROTicari.Sessionlar.Variables.loginkontrol = true;

            Session["kullaniciAdi"] = KullaniciTextBox.Text;
            Session["kullaniciId"] = DAL.DAOKullanici.GetEntity(DAL.DAOKullanici.KullaniciAdiIleKullaniciIdCek(KullaniciTextBox.Text)).ID;

            bool main_window_open = false;

            if (!main_window_open)
            {
                Page.RegisterClientScriptBlock("Main_Window", "<script>" +
                "var newwindow; " +
                "newwindow = window.open('" + "/dashboard/dashboard.aspx" + "', 'main_app_window', ' toolbar=0,location=0,directories=0,status=1,menubar=0,left=1,top=1,scrollbars=" + "1" + ",resizable=1,width=" + "1280" + ",height=" + "800" + "'); " +
                "if (window.focus) " +
                "{newwindow.focus();} "
                + "</script>");

                main_window_open = true;


            }
            HataLabel.Text = "";
        }
        else
        {
            HataLabel.Text="Hatalı Giriş";
        }
    }

I have no problem with it except the JavaScript part.

What I am trying to is after LoginButton is clicked opening dashboard.aspx and setting focus on it.And this code opens dashboard.aspx and sets focus in Google Chrome and Mozilla Firefox 4.However,when I try it on IE9 dashboard.aspx is opened but focus does not work and dashboard.aspx remains under the login page.

How can I set focus on a new window on IE9?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T06:45:19+00:00Added an answer on May 24, 2026 at 6:45 am

    I have had a similar problem to this and it seemed to happen because in IE9 (and any IE) that the focus() method is run before the window is rendered.

    To get round this there are two ways that I can see that will fix this:

    1. Set a timer to load the focus after a small amount of time.
    2. Defer the JavaScript from being read until the window is fully rendered.

    The timer method to me is not my preferred choice as in my personal opinion it is messy and if the page takes longer to load than the timer you are stuck with the same problem. To implement the timer you could use something like:

    Page.RegisterClientScriptBlock("Main_Window", "<script>" +
        "setTimeout(function() { " +
        "var newwindow; " +
        "newwindow = window.open('" + "/dashboard/dashboard.aspx" + "', 'main_app_window', ' toolbar=0,location=0,directories=0,status=1,menubar=0,left=1,top=1,scrollbars=" + "1" + ",resizable=1,width=" + "1280" + ",height=" + "800" + "'); " +
        "if (window.focus) " +
        "{newwindow.focus();} " +
        "}, 5);" +
        "</script>");
    

    I have set a delay of 5 seconds, which may be overkill.

    The defer method is my preferred choice as I feel it is cleaner and simpler, but it may or may not work:

    Page.RegisterClientScriptBlock("Main_Window", "<script type="text/javascript" defer="defer">" +
        "var newwindow; " +
        "newwindow = window.open('" + "/dashboard/dashboard.aspx" + "', 'main_app_window', ' toolbar=0,location=0,directories=0,status=1,menubar=0,left=1,top=1,scrollbars=" + "1" + ",resizable=1,width=" + "1280" + ",height=" + "800" + "'); " +
        "if (window.focus) " +
        "{newwindow.focus();} "
        + "</script>");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is the simple code: protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack)
I have this code protected void Page_Load(object sender, EventArgs e) { DataSet.DestinationsDataTable GetDestinations =
I've got this code: protected void ddlTemplate_SelectedIndexChanged(object sender, EventArgs e) { Template t =
I have this code: protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack) {
I have this code protected void Page_Load(object sender, EventArgs e) { TblPrikaz.BorderWidth = 1;
Really stupid design I believe but this is the code protected void Page_Load(object sender,
Here's the simple code: protected void DropDownList1_SelectedIndexChanged1(object sender, EventArgs e) { string word =
My code: protected void Page_Load(object sender, EventArgs e) { String userHost = Request.UserHostName }
i found this code: protected override void OnSourceInitialized(EventArgs e) { base.OnSourceInitialized(e); HwndSource hwndSource =
I don't understand the rationale of this code, taken from javax.swing.event.EventListenerList docs: protected void

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.