Question How to open popup window and redirect to another page

Sriram Surampudi

New member
Joined
Jun 16, 2021
Messages
2
Programming Experience
5-10
I have a situation, when I click on a button, I need to open a URL in browser's pop-up window and then redirect the current page to another page using C#.
But when I click on the button, I am not seeing the pop-up window but page is redirecting based on the condition.
To open the popup window I am using the ScriptManager.RegisterStartupScript( ) and then using response.redirect("xyz.aspx")

Could any one guide me on this.
 
Why are you using Script Manager.RegisterStartupScript method? That's designed to work with an update panel. An update panel is designed to update a region of a page without refreshing. Herein may be one of your issues. But I can't say for sure, since you haven not shared with us your code.

Next question is why are you using the response.redirect? Any action causing that method to be called will simply redirect your page...

Anyway, you should use ajax/js to call your popup window. It would be helpful to see the 'relevant' code you are currently using to create this popup window. Can you share?

This :
I need to open a URL in browser's pop-up window and then redirect the current page to another page using C#.
Redirection should be taken place when the popup window opens and from within the popup page. But why do it in such a bullshit way?
I click on the button, I am not seeing the pop-up window but page is redirecting based on the condition.
That can only mean you are redirecting from within the same page calling the popup window.

Can you also confirm what project type this is? I understand its a web app in dnf, but what type?

Also lets see the 'relevant' code as well.
 
Why are you using Script Manager.RegisterStartupScript method? That's designed to work with an update panel. An update panel is designed to update a region of a page without refreshing. Herein may be one of your issues. But I can't say for sure, since you haven not shared with us your code.

Next question is why are you using the response.redirect? Any action causing that method to be called will simply redirect your page...

Anyway, you should use ajax/js to call your popup window. It would be helpful to see the 'relevant' code you are currently using to create this popup window. Can you share?

This :

Redirection should be taken place when the popup window opens and from within the popup page. But why do it in such a bullshit way?

That can only mean you are redirecting from within the same page calling the popup window.

Can you also confirm what project type this is? I understand its a web app in dnf, but what type?

Also lets see the 'relevant' code as well.

We have a login page, when user clicks on the login button, we need to verify whether user is assigned with a popup window or not.
If popup window is assigned,
we need to show the popup window and redirect the page to landing page
Else
we need to redirect the page to landing page with out opening the popup window.

It's pure ASP.Net web application written using VB.Net, No MVC nothing.
 
Aha! If it is supposed to be a true ASP.NET WebForms app, then you shouldn't be tangling with any JavaScript. You should only be using the JavaScript that comes with ASP.NET web forms. But I can see how you possibly have a client that wants you to build a the Sydney Opera House, but using only shovels, hammers, and chisels. In this modern world of Web programming, you have to use some JavaScript, and there in lies your dilemma.
 
Back
Top Bottom