Asp.net prevent modal popup to get displayed while clicking on browser back button - asp.net

GoodEvening Everyone,
I am having one asp.net application which contains many links. some of the link displays modal popup Now if i move to link which nabvigates me and click on browser back button so modal popup gets display which i dont want. i need the previous page should get displayed instead of modal popup if i click on browser back button
for example
i clicked on link1 - navigated to page2
i clicked on link2 - displayed modal popup
i click on link3 - navigated to page3
Now if i click on browser back button so modal popup get displays instead of which i want the page2(previous page before the modal popup ) should get displayed.
So please let me know is this possible and how its possible.
It will be appreciated if some one provide me code to do this...
Let me know in case of more information required

There are several reasons this might be happening.
It might be that you are setting some state flags that persist between pages that influence the modal popups visibility. If you need help with this we will need some more details and preferably code samples.
It might be a browser caching issue. When you hit the back button the browser might be fetching the page from it's cache (not the server) with the popup visible. To test this you could disable the browsers cache and run through your process. If this proves to be the reason you can disable browser caching for your site by adding some meta tags (you'll find the exact tags on Google easily)

Related

Google Tag Manager Click Variables sometimes not populating on click

I'm using Google Tag Manager click variables click element and click url to track button clicks on my website.
For some reason, the Click variables are sometimes not populating upon click sending "undefined" data to Google Tag Manager.
For example the BOOK NOW button on this page in both desktop and mobile (http://www.maverickhelicopter.com/mobile/foodie.aspx) often fail to populate click variable data. This is just an example page.
It happens on other pages as well (both desktop and mobile version). If it refresh the page a few times or start a new session and try the click again the variables populate.
Does anyone know why this might be happening? Is it an issue with the way Tag Manager is loading, or with the html on the site? Website is built in ASP.net and Google Tag Manager is installed per the instructions provided by Google.
It's happening becuase the actual click element is different depending where exactly you click on your button. From your page:
Notice how "BOOK NOW" button is not fully highlighted. That means when you click outside of highligted area the browser understands to navigate to href page but actual clicked element in GTM is not the link <a href="..."> but rather your wrapper <div style="float:right; width:50%;> element which does not have url so that's why you can see "undefined"
You can fix it by removing any padding you have set on link inside your wrapper div.

loading different pages in Iframe on button click, button is in main page

I have a back and next buttons and Iframe in main page.
On pressing next button next pages (which are forms to take input) are displayed in Iframe from server side.
I want to save data of current page in DB and then load 2nd page in Iframe. On clicking again save data of Page2 in DB and then load 3rd page in Iframe.
Similarly if user clicks back button he should get data of previous page.
Please suggest me how it can be achieved.
Thanks
To chane iframe src just use JS
function changeFrm(NewSrc){
document.getElementById('YOUR IFRAME ID').src=NewSrc;
};
And in your button add onClick="ChangeFrm('NEW SOURCE');"
Good luck!

Mulitple Modal Popups not working in IE 7

I have two modal popups on a page, both inside user controls, and both have different names, and different behavior id's. Also, the hidden buttons used with them have different id's. I use javascript to click those buttons to show the popup.
On load of the page, the first popup is hidden, but the second one is not, and is at the bottom of the page completely visible. When I click the link that is supposed to show the second popup, the first one is shown instead, but the javascript to load the default values into the first popup does not run, so I'm confused as to what is going on. Any ideas?
I have solved the issue. My situation is bit different. for you both pop ups are in a user control. But for me only one is in user control and other one is in the page itself. hope this will shed some light on your issue.
I gave different id's for
Hidden Target button (TargetControlID)
OK button (OkControlID)
Popup Panel (pnlPopup)
Model Popup control
Still if you are not sure, try your page in firefox with firebug installed. This will help you to identify any java-script errors.
Hope this helps.

Disable a pop up page based on a value from another pop up page

On my main page I have two pop up pages.both of them have textboxes to be filled
By the user with save and close buttons .i need to disable one of the pop up pages if there are values in the other pop up page.how do I accomplish please give in your ideas.
Thanks
I don't know if i got you
you are saying they are two popup pages r u opening two pages in popup than you should not be doing that place the HTML in your page and open in the popup rather than the pages.
Any ways when ever your first popup is open and data has been validated you can make the link for second pop up visible false or disable it and it can be done on both server as well as client side.

How to refresh parent page from child page in asp.net 2.0

I have a page showing all products in a gridview.
I have a link in the page clicking on it opens a modal window.
In the modal window there is a form to enter product and save.
When I fill the form and save product I need to make the parent page to be refreshed so that
the new product is listed in the gridview and a message will be shown in a label in the modal window. I need to refresh the product list page without closing the modal window.
How to do it?
Please help.
You can refresh it with the following JavaScript:
window.opener.location.reload(true);
window.opener.location.reload(true);
true makes sure that the page is reloaded from the server instead of the browser's cache.
This will work only if the second page was opened by the first page using javascript and not when you open a link in the first page in a new window - window.opener will be null in the later case. Even in the former case, Firefox will throw a 'permission denied' error if both pages are not from the same domain.

Resources