I developed a single page website (like windows 8 tiles) and i put my aspx pages in iframe when i click a tile in default page it opens the related iframe in same default page. Its all working fine.
Here the problem is when default page is loading all the iframe aspx pages are loading it is unwanted and there it takes lot of time to load all the pages, it is not necessary to load the pages when i click the tile then the related iframe page will open.
How did i prevent this loading aspx pages ?
A possible way around this would be to leave the src attribute of each iframe empty and use javascript to change it on click.
For example, you could create an iframe like
<iframe id="ifrm" src=""></iframe>
and add to the tiles an onclick event with the following javascript:
document.getElementById['ifrm'].src = "http://www.test.com";
Related
I'm using ASPX web pages (WebPage1.aspx) and have an HTML iFrame defined in this page. I dynamically define the iFrame src (via code behind) when my ASPX web page loads ... all good so far.
The web page that gets loaded into my iFrame supports a "ReturnURL" that I've defined when I set the src for the iFrame. Something like:
src = "https://www.someothersite.com/Somewebpage.aspx?ReturnUrl=http://www.mywebsite.com/WebPage2.aspx"
The web page (Somewebpage.aspx) has a "Return" button, the user clicks the Return button and they should get redirected back to the "ReturnURL" I specified (http://www.mywebsite.com/WebPage2.aspx).
What happens is http://www.mywebsite.com/WebPage2.aspx gets displayed in my iFrame on http://www.mywebsite.com/WebPage1.aspx. This IS NOT what I wanted, I wanted to simply be return to http://www.mywebsite.com/WebPage2.aspx.
Is there a solution to this problem within the context of ASPX and code behind?
Cheers, Rob.
What I have at the moment is a page which I am using as a sirt of site master for my html pages. The way I am doing this is by referencing the master page using this line of code:
<iframe scrolling="no" style="width:100%;" frameBorder="0" src="WebForm1.aspx"></iframe>
Now that works fine, I can create a new page and reference that, and then the content from that page will appear on any page referencing it.
But I have a problem, what I want Is if you click the navigation button that is in header of a page that is referencing this site master; it navigates away but only the iframe will hold the webpage, and the main content will still be the same.
For example:
In the master page I am referencing using the Iframe, I have some code that when you click on a button it navigates away, ok. But if I go into a page that is referencing the master and click the button, the new web page will only open in the iframe section at the top of the page.
Sorry for this complicated question, if anyone understands it, then any advice would be helpful!
The page that is referencing the master:
http://codepad.org/IyrDxAf9
The master page itself:
http://codepad.org/XMu67H1M
PS...I am coding this in asp.net using html
The aim of all this is to create a master page for html, but I am not having much luck with it
You can set the following in your webform1.aspx page:
<base target="_parent" />
This will target all the links on that page to the 'parent' window. You can also do this with individual links.
Seeing as you are using .aspx pages here, is there a reason why you are not using the built in master page functionality?
I had a page(Home.aspx) containing menu on the top and another master page, with same menu on the top.
Now, when i have to move from Home page to master page, i use
window.location = 'test.aspx';
Now, when i need to move from master to main(Home) page, i need to call a function with a parameter, containing control url, which has to be loaded to the iframe in the Home page.
Can anybody suggest how can i load Home page and iframe within simultaneously using javascript.
If you don't want the user interact with the page until the iframe is loaded, you can disable the page with javascript (onLoad of the page <body onload="disablePage()">) and enable again when the Iframe is loaded (onLoad of the Iframe <iframe onload="enablePage()"... )
Here some post about disable or gray out page: CSS/JavaScript Use Div to grey out section of page
I'm using Master Page in my ASP.net application, in the master page I put a ContentPlaceHolder in Update Panel to support AJAX in child pages, the question is how to stop Refreshing "master page controls" while navigating between pages?
For navigation between pages I tried to use Response.Redirect, windows.location java script with no success, shall I use the Frames or IFrames instead of Master Pages to stop Refreshing?
any suggestion to solve this issue will be highly appreciated, Thanks in advance...
If you don't want the page to refresh when switching between "pages", you will not have any good solution using master page. As others have said in different words, the master page is just a common "template" that is used by different pages. The navigation between is just like calling different pages, and of course will reload the entire page, including the master page content.
A sollution I have used with Ajax is
to have each "page" as a user
controls, and put them all in an
UpdatePanel with visible="false".
Then for navigation between "pages", switch
visibility for the user controls
to show the right "page" control.
The alternative is to use iframe.
Neither of these solutions use MasterPage.
The MasterPage concept was designed to simplify a common look before Ajax was introduced in ASP.NET. After Ajax became popular, the demand for not refreshing the entire page has been more common.
A masterpage is nothing more than extending your "normal" page with (most of the time) the default layout of your application. The master page and the contentplaceholders are rendered as a full html page. When you navigate between pages it is the normal behavior that your whole page refreshes. This is how the web works.
Working with an iframe could solve your problem. However that has some other side effects:
The whole masterpage isn't useful anymore. The content around your iframe is the "masterpage".
With a masterpage you actually browse to another url, you also see in the url bar of your browser. When you work with an iframe you navigate within the iframe to another page. The url in your browser will stay the same. When the user of your application hits the refresh button it always starts again at the default page you assigned to your iframe in the html. Of course there are some workarounds
Anyway. It really depends on your application. There are multiple solutions to work around the refresh behavior.
Having a structure like the one you've explained:
Master
Child page 1
Child page 2
...
Then you cannot prevent the page from refreshing when you switch from page 1 to page 2 etc. for you have a single "page" entity (master content + selected page content) when it's rendered to the browser.
If you want to switch betweent different app views inside the very same page (so to prevent a complete page refresh) you could use a single page (the Master becomes quite useless) with an updatePanel in which you load the different views.
You can also use iFrames, but if you have to handle any type of communication between different parts of the page (some of which are inside iFrames) I would personally advice not to use them.
I have an requirement that, in my application on clicking an button I have to load one more application with the same template which I was using for my application.
So, on clicking the button in my application I have used one intermediate page in that using iframe I passed that URL of an external application. Its working fine.
But the problem is in the external application which is not in my control on clicking an button it is moving to next page. In that page I want to hide an button.
I did that also using div tag color as white and set the positions.
But the problem is in all the pages in the same position that is affecting. So I want to get the URL of the page which is loading in the iframe on the second or third click of an external application, so that I can using some conditions I can hide the control.
You can use Javascript. Give the iframe an ID
var iframe = document.getElementById(id);
The url is accessible via the "src" attribute:
iframe.src
more info