• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 441
  • Last Modified:

Popup ASPX page wont stay modal up front

Hello all.  I have a popup ASPX page that is called from a click even in my code behind button.  Problem is the main parent page is posting back and for some reason it keeps staying in front and my popup page is minimizing on the bottom.  Any idea what I can do?
0
sbornstein2
Asked:
sbornstein2
  • 4
  • 2
1 Solution
 
Raju SrivatsavayeSoftware EngineerCommented:
did you use window.focus in your script
0
 
brdrokCommented:
Do you SmartNavigation enabled?  If so, you'll need to turn it off or set it to false;
0
 
sbornstein2Author Commented:
brdrok where do I turn that off I will try that?  sriv I placed that into an onblur in the body and it did not work.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
sbornstein2Author Commented:
I dont know if I want to mess with smartnavigation if it is by site because I am working as another developer on a project that already exists and dont want to mess with it too much.  It seems there is other popup pages that work fine and I looked through everything and mine is the same so it seems like the parent page I call it from might be in question.
0
 
brdrokCommented:
When you look at the HTML part of your web pages, at the top you should see something like the following:

<%@ Page language="c#" Codebehind="AddUser.aspx.cs" AutoEventWireup="false" SmartNavigation=true Inherits="SomeNameSpace.admin.AddUser" %>

"I dont know if I want to mess with smartnavigation if it is by site... " 

It is not by site, it is by page.  Every HTML page should have this page declaration that you see above.  Not sure about placing it inside the "onblur" event of the body tag...I have a pop up calendar that I call like so:

btnCalendar.Attributes["onclick"]=@"javascript:calendar_window=window.open('Calendar.aspx?formname=Form1.txtDate', 'calendar_window', 'width=200, height=200'); calendar_window.focus(); calendar_window.moveTo(420, 285); calendar_window.focus();";

Just irgnore the queryString (?formanme=Form1.txtDate) part.  
0
 
sbornstein2Author Commented:
Ok guys I found out the problem and maybe you can help me here.  I actually have this fixed but I am trying to also do one thing.  I found that in the parent page there is a setfocus to the first textbox control that was causing this.  It looks like this.

PARENT PAGE:
at top of page

<script>
      var setFocus =true;
</script>

bottom of page
<script>
      if (setFocus) {
      document.getElementById("login_user").focus();
      }
</script>

so this was causing it.  I set it to false and it worked great.  So now I am trying to figure out is there a way to set the setFocus variable to false in the code behind easily?  I have worked around it by placing a set focus same way in the popup to my first control but I would rather leave that and still somehow set that setFocus in the parent to false.  Thanks again guys.

0
 
sbornstein2Author Commented:
RegisterClientScriptBlock("nofocus", "<script>\nsetFocus = false;\n</script>\n");
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now