I am trying to get one of the webforms in my application to link to another website, outside of my application. I can get the page to load as a new webpage in my browser easily but I need to keep my masterpage in view.
Can this even be done?
TIA
You could use the IFRAME tag:
<iframe src="http://www.google.com" title="Google's Website">
<!-- Alternate content for non-supporting browsers -->
</iframe >
Related
I'm building up a website in ASP.NET Webforms and Bootstrap.
I have created a webform with masterpage page which contains a link to open up the Bootstrap modal with contents of another page ( Test.aspx ).
<a href="Test.aspx" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#modalTime">
Launch demo modal
</a>
The Test.aspx page is also a webform with masterpage file because without the modal it has to have the same content ( header, footer, ... ) as all other pages when you surf to it.
But in the modal it also adds the content of the masterpage ( header, footer, ... ). Which is normal, I understand this.
But is their another way or component or something else that when you surf to Test.aspx you see all the contents and in the modal you only see some content? Displaying only content within a Contentplaceholder?
Or is this only possible in MVC because of the use of views? Maybe there is something simular in webforms?
This can be solved in multiple ways. The two ways I would suggest is the following:
1) Move most logic out in an ASCX control. Then you can keep test.aspx, but also have a new one called Modaltest.aspx, and you can use that one for the modal window.
2) On the masterpage, you have a property called "IsAjax", that looks at the header. If the header is an AJAX call, you simply remove all its surroundings. We've done that at one of our legacy Web Forms project at work, which works OK.
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";
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'm running into what looks like a contradiction between jQuery Mobile and ASP.NET Forms. I have two pages that I'm transitioning between using jQuery Mobile page transitions. The basic structure looks something like this:
<html>
<body>
<div id="page1" data-role="page">
<form id="aspNetForm" runat="server">
Page 1
Page 2
<!-- Some more ASP.NET controls that require the aspNetForm -->
</form>
</div>
<div id="page2" data-role="page">
Page 2
Page 1
</div>
</body>
</html>
Notice that the form tag is only present in the first page. That's because ASP.NET only allows one form per page. When I try and move the form tag outside of the page divs jQuery Mobile starts acting strange (specifically the page transitions start looking strange). This becomes a problem when I want to use any sort of ASP.NET web controls that deliver input inside the second page.
Basically these rules exist that essentially lead to a contradiction:
ASP.NET:
1) All web controls that deliver an input must be within an ASP.NET form tag
2) Only one ASP.NET form tag can be visible (as in visible=True, not display: block) per page request
jQuery Mobile:
1) All content, including forms, must be within a page div
Can anyone think of a way to get around this? I guess I could restrict page2 to only use traditional HTML and not web controls but that doesn't seem like the most elegant solution. Any ideas? Has anyone else run into this?
Well. In my opinion, the simple solution would be to give each page its own .aspx-file. That would work just fine.
If your site is very big, it would also improve performance.
I have more than 100pages in my project & a single master page for all this. My masterpage has links to different pages. I want to change only the ContentPages( Child Pages) & my masterpage should not get reloaded.
For Example:
My Master page is : SiteMaster.master
Child Page1: Add.aspx
Child Page2: Sub.aspx
When I execute, Add.aspx comes inside the SiteMaster.master. Know, When I click the sub.aspx link inside the Add.aspx, only add.aspx page should be changed & sub.aspx must be loaded. I don't want to reload the master page.
If possible, please post some examples or links.
Your expected behavior is not exactly how master pages work. There may be ways to achieve a no postback solution in this scenario but the easiest one would be to use an <IFrame /> (which is usually frowned upon)
Master page is part of your pages. It's not loading separately.
Simple explanation:
ASP.NET engine takes your aspx and puts it inside the master page and then renders it as one page, then serves it to user.
If this is not what you want and you want that only content of your master page be loaded, then you should not use master pages at all! It's against nature of master pages. they act like skins for aspx pages.
Search for HTML IFrame tag and don't use master page.
P.S: IFrames are not used widely in this days.