Hello,
I am using the script below to open a new window and once opened, redirect to that open window from the original window:
private void btnNewPDFWindow _Click(object sender, System.EventArg s e)
{
string NewPage = "NewPageZoom.as px";
string ScriptBlockNewP age = "<script language='javas cript'>var
NewPDFPage=wind ow.open('" + NewPage + "','PDFPage');" ;
ScriptBlockNewP age = ScriptBlockNewP age + "NewPDFPage.foc us();</script>";
Response.Write( ScriptBlockNewP age);
}
For some reason, with the code above, I have to click the button twice in order to get it to focus to the 2nd window again.
Any ideas?
Regards,
TC 3 1949
At a guess, it might be running the focus code before the window has finished loading completely, on your second click the window is already loaded so the focu works.
Try putting a timer delay into the javascript to see if its that
--
Regards
John Timney
ASP.NET MVP
Microsoft Regional Director
"TC" <ge**********@y ahoo.com> wrote in message news:eO******** ******@TK2MSFTN GP15.phx.gbl...
Hello,
I am using the script below to open a new window and once opened, redirect to that open window from the original window:
private void btnNewPDFWindow _Click(object sender, System.EventArg s e)
{
string NewPage = "NewPageZoom.as px";
string ScriptBlockNewP age = "<script language='javas cript'>var
NewPDFPage=wind ow.open('" + NewPage + "','PDFPage');" ;
ScriptBlockNewP age = ScriptBlockNewP age + "NewPDFPage.foc us();</script>";
Response.Write( ScriptBlockNewP age);
}
For some reason, with the code above, I have to click the button twice in order to get it to focus to the 2nd window again.
Any ideas?
Regards,
TC
TC,
I would create a Literal Control and write the script text to that control.
Protected WithEvents script As System.Web.UI.W ebControls.Lite ral
script.text = '<script language=javasc ript...........
Arne.
"TC" wrote: Hello,
I am using the script below to open a new window and once opened, redirect to that open window from the original window:
private void btnNewPDFWindow _Click(object sender, System.EventArg s e)
{
string NewPage = "NewPageZoom.as px";
string ScriptBlockNewP age = "<script language='javas cript'>var NewPDFPage=wind ow.open('" + NewPage + "','PDFPage');" ;
ScriptBlockNewP age = ScriptBlockNewP age + "NewPDFPage.foc us();</script>";
Response.Write( ScriptBlockNewP age);
} For some reason, with the code above, I have to click the button twice in order to get it to focus to the 2nd window again.
Any ideas?
Regards,
TC
Why wouldn't you change this to a client-side event? You have the button
as a server-side button, which means the page already has to be reloaded
just to show another page.
Change the button to a client-side button, and add the javascript code
as a script block(RegisterC lientScriptBloc k ). Change your javascript
routine to run as a function. Call the function from the client-side button.
If you need to focus the window, you have much more control over it that
way. You can put in a brief timeout after opening the window, and then
call the focus method... something like this(syntax?)
function OpenPDFPage() {
NewPDFPage=wind ow.open('NewPag eZoom.aspx','PD FPage');
SetTimeout(5,'N ewPDFPage.Focus ()');
}
Much more reusable.
Lowell
TC wrote: Hello,
I am using the script below to open a new window and once opened, redirect to that open window from the original window:
private void btnNewPDFWindow _Click(object sender, System.EventArg s e)
{
string NewPage = "NewPageZoom.as px";
string ScriptBlockNewP age = "<script language='javas cript'>var NewPDFPage=wind ow.open('" + NewPage + "','PDFPage');" ;
ScriptBlockNewP age = ScriptBlockNewP age + "NewPDFPage.foc us();</script>";
Response.Write( ScriptBlockNewP age);
}
For some reason, with the code above, I have to click the button twice in order to get it to focus to the 2nd window again.
Any ideas?
Regards,
TC
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: getmyemails2 |
last post by:
Hello,
I am using the script below to open a new window and once opened,
redirect to that open window from the original window:
private void btnNewPDFWindow_Click(object sender, System.EventArgs e)
{
string NewPage = "NewPageZoom.aspx";
|
by: TC |
last post by:
Hello,
I am using the script below to open a new window and once opened, redirect to that open window from the original window:
private void btnNewPDFWindow_Click(object sender, System.EventArgs e)
{
string NewPage = "NewPageZoom.aspx";
|
by: AnalogKid17 |
last post by:
I have the following line of code in my start/login page:
document.getElementById("txtLogin").focus();
When I run the website app through F5 (Debug, Start Debugging) it works
fine (ie, focus on txtLogin). When I run with CTRL+F5 (Debug, Start
without debugging) the focus defaults to the URL box.
Can anybody unveil the mystery ?
|
by: amit |
last post by:
Hello group,
I'm having a problem with an HTML element performance. When I use
focus() method to jump to an input text. I realize the cursor is on
waiting on the 2nd column waiting for user to enter a number. This is
the HTML part:
<input id="id_Text_Octet1" type=text value="" maxlength="3"
onkeyup="SomeFunction(event, this.id);" style="border:0;width:
25px"><span style="font-size:18px;">.</span>
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |