.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to prevent Javascript window to steal focus

Posted By:      Posted Date: September 02, 2010    Points: 0   Category :ASP.Net
Hi,I have made an asp.net web application in which i open a javascript window for 4 seconds at regular interval . The problem is that when window opens it steals focus from current application. For example when application is running in background or is minimized and i am typing in word/Excel or outlook, the window pops up and steals the input focus.I want to popup window in some way that it never steal focus from some other application, just like msn or gtalk notification when someone sign in/out.Please suggest how it can be done ? Thanks

View Complete Post

More Related Resource Links

How to prevent the window stealing focus on .Net framework 3.0?



We created a wpf window which will be poped up on the right bottom of the screen, like the notify window of MSN when contact is online, Topmost is set as true for this window, When this window shows, it will steal the focus of current application. For example, user is typing, when this popup window showed, it steal the focus and interrupt user's typing. It is boring.

How to prevent the window stealing focus on .Net framework 3.0?



lossing focus from model pop up window controls


hi i using a model pop up window with some textbox but when i click on textbox of model pop up focus move to back to page textbox control plz help me 

way of calling "javascript function of parent window from child window."

The article way of calling "javascript function of parent window from child window." was added by raja.s on Sunday, June 06, 2010.

Hi,Here i am going to explain how to call the javascript function of a parent window from the child window(pop-Up).Some may know before reading this post.Parent Java Script Function:script language="Javascript" type="text/javascript">

Browser window is opening up on the second click with javascript code



I am trying to set a javascript code to open up a new browser window with this URL that exists like shown below.

On the first click nothing happens but on the second click the browser window is opening up.


How is it possible to make it open up on the first click ?

                                <asp:ImageButton ID="ImageButton3" runat="server" Height="84px" 
                                    ImageUrl="~/images/1.jpg" Width="165px" 
                                    onclick="ImageButton3_Click" />

    protected void ImageButton3_Click(object sender, ImageClickEventArgs e)
        String openURL = "javascript:window.open('" + "Folder1/testing.aspx" + "');return false;";
        ImageButton3.OnClientClick = openURL;


Closing Javascript Modal dialog window after server side event processing


Hello Friends..

Please tell me how to close Javascript ModelDoalog Window.. after Server Side event Processing .

Basically i want close window in  finally Block After sucessfulll Updation.

AMit..... InnocentInnocentInnocentInnocentInnocentInnocentInnocent

How to prevent collapsible panel from closing modal window

I have a collapsible panel extender inside a modal window, my problem is that whenever I click on the link button (to expand my panel), the window closes. Does anyone know of a way to avoid this?

Javascript required to get a pop up window from new form.

Hello Team, Any help regarding this would be helpful. I have a new form. In that form when i go to the first field...it should open up a pop up window which would have a note in that. How is this possible. I think through javascript this can be possible. So please help me. Thanks in advance.

Closing window in javascript without confirmation

Hello! I need to open a browser window without Toolbars, Status bar and Explorer bars (this means no back, refresh, ... buttons, no histiry, no nothing visible in this browser window). This is what I do: from normal browser window I open new window with all the properties I need and than I close the first window: <body>     <script type="text/javascript">  window.open('login.aspx','','toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,                        left=0px, top=0px,width=1024, height=768');  window.close();     </script> </body> This would be OK if the first window would just close, but it doesn't. I get the confirmation window with this text: The Web page you are viewing is trying to close the window. Do you want to close this window? I don't want user to have to close the window manually. Can somebody please tell me how to close browser window without the confirmation popup? Thnx in advanced, dvale

How to prevent special character encoding when using xslt value in javascript variable

Hi, I've created a dataview and inserting a little bit of javascript. I need to store one of the xslt values into a javascript variable. The problem is that when I get the value into my javascript variable, it is already encoding special characters . for example, instead of "<", I get "&lt;" Am I doing something inaccurate here? I even tried using the javascript unescape() function, but that didn't work. would you be able to advise how to get the xslt value into a javascript variable as it is without having the original data changed? <xsl:template ... ... <SCRIPT type="text/javaScript"> <![CDATA[ ...     var myData = ']]><xsl:value-of select="@sampleData" disable-output-escaping="yes"/><![CDATA['  ;  ... ]]> </SCRIPT> Pman http://www.pmansLab.com/

How to Get PrintPreview window using javascript in Asp.Net

Hi All,I am using Window.Print() method to print a webpage. When I am click print button in my page. Print dailog window is opening there I have the options only to print the form or cancle. Before print I want to view the content how it is going to print. In browser File menu we have Print Preview. I want to give same feature when user click on Print button. How to open print preview window using java script?Thanks in advance

Open New Window Using Javascript

Using SSRS 2008. I have a main report where the user clicks on the KPI field and I want to open a new window and go to a detail report and pass parameters from the main report to the detail report. The following javascript will do that but when the KPI has "&" in it I get the following error. In this example the KPI field clicked on had "Headcount Imp & Ops" in it. Keep in mind the KPI field could have the "&" at anytime. Anyway around this? I appreciate any help. Error = The path of the item '/Test/DetailRpt, Imp' is not valid. The full path must be less than 260 characters long; other restrictions apply. If the report server is in native mode, the path must start with slash. (rsInvalidItemPath) Code. = "javascript:void(window.open('http://velma.fmr.com/ReportServer/Pages/ReportViewer.aspx?%2fSPARS%2fDetailRpt&rs:Command=Render&rc:Parameters=true&RptMonth=" & Parameters!RptMonth.value & "&Reports=" & Parameters!Reports.value & "&ID=" & Fields!ID.Value & "&Alias=" & Fields!KPI.Value & "&BD=" & Parameters!BD.Value & "&BD=" & Parameters!ED.Value &" ','_blank','width=875, height=400, top=75, left=35, toolbar=1, menubar=1, location=1, status=1, scrollbars=1, resizable=1'))"

opening new window from code behind using javascript



I am trying to open new window when i click on a button using javascript

Page.ClientScript.RegisterStartupScript(this.GetType(), "openwindow", "window.open('WebForm2.aspx','','height=200,width=300');", true);

this is the code i am using.

But the problem is it postsback whole page.

Can some body tell me how i can open new window without posting back the page.



System.Windows.Forms.ListBox scroll-to-top on focus - how can I prevent this behavior?




I've been trying to find a solution online for the last couple days and I'm surprised at how little there is on this topic -- namely, I'm trying to prevent the default behavior of ListBoxes scrolling to the top whenever they regain focus.


I've created a toolbar-like control that is docked on the left-hand side of my screen.  This vertical toolbar is comprised of several ListBoxes, and each ListBox is collapsible (much like the Visual Studio designer toolbar).  The problem is, if I click on an item on a ListBox that is partially off the top of the screen, the entire toolbar scrolls so that the first item in that particular ListBox is at the top, so your mouse is no longer over the item you originally wished to select.


I'm trying to figure out a way to prevent this behavior.  Any suggestions?



prevent postback javascript problem


i have the following example but i get error on GetPostBackEventReference line

value of tpe ...button cannot be converted to....

second question:where should i put this code? do i need just this code and nothing else

how should i for example delay for 20 seconds??

Dim sb As New System.Text.StringBuilder()
            sb.Append("if (typeof(Page_ClientValidate) == 'function') { ")
            sb.Append("if (Page_ClientValidate() == false) { return false; }} ")
            sb.Append("this.value = 'Please wait...';")
            sb.Append("this.disabled = true;")
            Me.btnAddPhotoComment.Attributes.Add("onclick", sb.ToString())



javascript window.history.back() issue with Modal popup extender



I have a asp.net page that has a list of items. When one of the items from the list is clicked a details page is displayed. This details page has a link button to show a popup for history of the item. The details page also has a button with text 'Back'.  The back button has onclick event set to  "javascript:window.history.back();".

This back button works fine and goes back to the first page. However when the user is on the second page and opens the pop up by clicking on the link button, the back button stop working and displays Webpage has expired message.

Any help would be appreciated.




javascript alert window when dropdown field is selected,



is there a way..where an alert window prompts up to remind the user to select a checkbox when one field in dropdown is selected..for example

there is a dropdown field(Status)  which contains (Tobe confirmed, confirmed and rejected ), when confirmed is chosen..an alert window prompts up reminding the user to select a checkbox(send email) - Yes or No. It is not compulsory for the user to select the checkbox, but if Yes is chosen, the workflow will send an email

Problem with a Javascript Popup Window Minimizing itself


I am new to Javascript.  I have seen other posts about this, but I have not been able to resolve my problem. I have a WebPage that allows a user to click a LinkButton. When the LinkButton is clicked. I execute the following Javascript code after registering the ClientScriptBlock:

<script language='Javascript'>
PopupWindow = window.open('StandardImageLookupPage.aspx','PopupWindow');
PopupWindow.resizeTo(screen.width, screen.height);

No matter what I do the popup window comes up for a brief second and then minimizes itself. I prefer that the window stays maximized.

I am stumped. Any help would be much appreciated.

ps. I am not sure if this makes a difference, but the WebForm that calls this javascript is a user control.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend