WindowWizard - Unlocks the ability to open two windows simultaneously with just one click

Every time I click on the button below, it seems to open the page twice. I'm having trouble identifying the issue:

The code in the .cs file:

protected void Page_Load(object sender, EventArgs e)
{ 
     if (!Page.IsPostBack)
     {
         btnPrint.Attributes.Add("onclick", "openWindow(" + Request.QueryString["cId"].ToString() + "," + Request.QueryString["aId"].ToString() + ");");
     }
}

The javascript function:

<script type="text/javascript">
    //Function To Open A New Window To View the selected PDF
    function openWindow(cId, aId) {
        window.open("printMe.aspx?cId=" + cId + "&aId=" + aId + "", "", "", "");
    } 
</script>

The button in the aspx file:

<dx:ASPxButton ID="btnPrint" runat="server" Image-Url="~/images/print.bmp" ToolTip="Printer Friendly Page">
</dx:ASPxButton>

Answer №1

After making the following modifications to the JavaScript, I was able to resolve the issue. Even though I am not proficient in JavaScript, this solution worked for me.

<script type="text/javascript>
    //Function To Open A New Window To View the selected PDF
    function openWindow(cId, aId) {
        window.open("printMe.aspx?cId=" + cId + "&aId=" + aId,"mywindow");
    } 
</script>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Error encountered in Browserify bundle.js: exec function is not executable

After setting up Node.js, npm, samba-client, and browserify on my system, I encountered a frustrating issue in my bundle.js file. An Uncaught TypeError related to the 'exec' function has been causing trouble, and despite my efforts, I have been u ...

How to dynamically update data in Angular without the need for a page refresh or loading?

Looking to enhance a wishlist feature by enabling users to delete items from the list without the need for a page refresh. Here's my approach: wish.controller('wishCtrl',['$scope','$http','$cookies','$wind ...

Assistance with designing in JavaScript and Python

Currently, I have a setup where my external website is extracting data from an iframe within our internal company intranet using Javascript. The extraction process is successful, but now I am faced with the challenge of accessing this harvested data in ord ...

Guide on transferring hexadecimal color string from .aspx to .ashx

Is there a way to pass a hex string value to my .ashx page, where it is required in System.Drawing.Color? When I pass a regular string like: string name = "John" Everything works as expected. But if I attempt to pass a hex value like: string bg_color ...

Using the react-bootstrap library, I have successfully integrated a Navbar

The navigation bar below is not functioning properly, and the container is causing the links to lead to a 404 error page. I have attempted writing it in various formats: <Nav.Link href="" >Name</Nav.Link> <Nav.Link href={"&qu ...

utilizing the default placeholder image for videos and audios within the tags

In my web application, users can share music and videos that will be stored on a server used by the application. Some audio/video files come with posters or thumbnails attached to them. I want to display these posters along with the audio or video using HT ...

Use Node and Express with JavaScript to store HTML form data in JSON format within a .json file

Just starting out with node and express. I am capturing user input from an HTML form and attempting to append or push it in a .json file. I tried using the jsonfile npm package but the data is not being stored in an array format in the JSON file. Here is ...

Streamlining the process of implementing click events on elements selected by class using jQuery

Slowly but surely, I am gaining familiarity with jQuery and have reached the point where I desire to abstract my code. However, I am encountering issues when attempting to define click events during page load. Within the provided code snippet, my objectiv ...

Automatically toggle Bootstrap checkbox switch to OFF upon successful completion of AJAX script

On my Employee screen, I have an HTML Form with a Bootstrap Checkbox Switch that toggles the visibility of password change fields. Clicking it reveals or hides the fields accordingly. I'd like to set this switch to "off" when the AJAX script updates ...

Listening for Events from Child Components in Vue.js

I am struggling to figure out how to send an event from a child component to its parent in order to change the view. Although I have been able to create and emit the event, my template does not seem to be properly registering it. I am working with Single ...

Is there a way to combine multiple incoming WebRTC audio streams into one cohesive stream on a server?

I am currently working on developing an audio-conferencing application for the web that utilizes a WebSocket server to facilitate connections between users and enables streaming of audio. However, I am looking to enhance the system by transforming the serv ...

Tips on editing a file exclusively when a specific requirement is fulfilled

Looking for a way to implement a put method within an Express API that allows users to update a document conditionally? Consider this scenario: you have an Instance document with an attribute called executed, which is set to true if the instance has been e ...

Storing video blobs in the filesystem using Electron and Node.js

My electron application allows users to record video from their webcam using the MediaRecorder API. After hitting the "stop record" button, I am able to obtain a blob of the recorded video. I am trying to figure out how to convert this blob into a real w ...

What is the process for converting strings or text to EBCDIC using JavaScript?

In the midst of developing a website, I am working on a feature that allows users to input a minimum of 256 characters/strings (with code verification), choose between ASCII or EBCDIC conversion, and view the converted text string displayed on the page bas ...

Generate a graph showcasing the frequency of character occurrences within a specific column of a .csv file

I'm currently working on creating a graph using d3.js What I need to accomplish is reading the some_column column in a .csv file and counting the occurrences of | to plot them accordingly on the y-axis. The line should be plotted based on the number ...

Having trouble in React.js when trying to run `npm start` with an

Upon initially building a todo app in react.js by using the command: npx create-react-app app_name When I proceeded to run the command npm start, it resulted in displaying errors: https://i.sstatic.net/BxYFu.png https://i.sstatic.net/EqU1j.png In furth ...

Adjust the speed of the remaining divs below to move up when one is deleted using Ajax and jQuery

My div elements are arranged from top to bottom, and when one selected div is removed or faded out, all other divs below it shift up suddenly to fill the gap. While this behavior is functional, I would prefer to slow down the movement of the divs shifting ...

Locate an array within a Multidimensional array and relocate it to the starting position

I've been attempting to figure out a solution for moving a specific array within another array to the beginning. The problem I'm encountering is that the code I was using, as suggested in a previous question, only removes the last value and plac ...

Encountering difficulty when determining the total cost in the shopping cart

I am currently working on a basic shopping cart application and I am facing an issue when users add multiple quantities of the same product. The total is not being calculated correctly. Here is my current logic: Data structure for Products, product = { ...

When attempting to access localhost:3000, the React/NodeJS web page fails to load

As a new developer working with React and NodeJS, I am eager to dive into these technologies: React for the client-side NodeJS for the server-side Webpack for building my files Here is the structure of my project: my-application/ webpack.s ...