I play around with mvc.net vnext and I read several posts about the possibility to use #RenderBody async but I never found a tutorial how to do this.
So what I have a _Layout.cshtml with a navigation bar.
Inside this bar I have several links to pages like:
<li><a asp-controller="Home" asp-action="Index" ><i class="material-icons">home</i></a></li>
now after a click on that link, the page does a full postback...thats normal.
But as I wrote, if I remember right, there is an option to only load the new content in an async way in MVC6 without using self written javascript stuff.
Do you have some resources / tutorials?
Thanks :)
Related
I am planing a simple website layout: Header with navigation, sidebar and a content block.
The whole site should be a single-page application because I am using a Cesium Visualization and a page reload would delete the current JS objects that are displayed in the Viewer.
Therefore I would like to reload the content container using AJAX to display my different "pages" and therefore keep all the JS Objects in the browser.
My question is:
Do you know a way to add a url-based navigation to this architecture?
For example: I am on the index page /index/ and enter the new url /content1/. The new url reloads the content container using AJAX and keeps the rest as it is. Therefore I would also be able to use the forward and backwards buttons of the browser.
May this be possible with ASP.net MVC routing?
I am pretty new to this so I hope I discribed my problem well enough.
Thanks a lot!
Try Pjax which uses ajax to load content dynamically via ajax
and pushState to maintain url history i.e is a HTML5 api. You shall find more details in the link below
https://github.com/defunkt/jquery-pjax
If you are familiar with angularjs then using ngRoute is a better alternative to Pjax as it has an effective url management through the routing service, please check the below link for more details on ngRoute
https://docs.angularjs.org/api/ngRoute/service/$route
I a problem with my site..
There is a logo in my site thats redirect to the Home page.
The problem is that if for example i'm in page www.domain.com/about and I press the logo - everything fine and it goes to www.domain.com/Main, but if i'm in page www.domain.com/page/125 It's redirect me to www.domain.com/page/Main instead of www.domain.com/Main.
I have all the site files. which file I should change?
Is it the sitemap?
(I have no page name page or 125...)
Thanks!
Without knowing how your project is structured or if you're using WebForms or MVC, it's difficult for the StackOverflow community to help you. Please update your question with more details if the below suggestion doesn't help or apply.
If you're using using WebForms with MasterPage and content pages, the logo is usually in the MasterPage e.g. Site.Master
Try and find something like this in your Site.Master
<img src="logo.gif"/>
and replace it with this
<img src="logo.gif"/>
or this
<a runat="server" href="Main"><img src="logo.gif"/></a>
I'm not a web developer. I'm a budding game developer and I'm just making myself a website for my portfolio.
I made this as a little college project. Its just one html page with almost nothing on it. And everything is added to the DOM with javascript (when you go to a new 'page' the last stuff is removed)
For my portfolio site I want to do something similar to this. Where the title / breadcrumbs and so on remain static and the content changes depending what project you want to look at.
In my bookshop example the JS add/remove was convenient cus all the books had the same types of info and it was just stored in a little database like structure.
For my portfolio website each project content bit might have a different layout / info as each project is different. (eg some might be just a video, some might be all text etc.)
So iframe springs to mind but I know that iframes are bad for accessibility and thats something I want to avoid as a general principle.
Any of you web guys have any ideas as to how to load a page (or achieve something similar) into another page without iframe so it is really part of its host page and reads that way not just visually but would read properly by a blind person say (I forget the word for this!)
Consider using php to fill a div with the information. You can then store the project content in a separate file from the rest of the page, and it is separated from a markup standpoint as well (which is what I'm guessing your after?)
Note that the user will receive both pages together, its only separate from the server's point of view.
For example (untested):
<html>
<body>
<div id="projects">
<? $page = file_get_contents("projects.html"); echo $page; ?>
</div>
</body>
</html>
We have created a button template where an editor can associate a web analytic tag with it. The issue is we would like to reuse this button component on the same page but still be able to differentiate where on the page it is coming from.
Has someone encountered this issue before? We're looking for some insight into the problem and perhaps some ways to solve this without modifying the template.
FYI, we are using Tridion 2009 SP1.
Thanks!
Updated with HTML
<a href ="/security.jsp" onClick="trackCustomLink('tttt:p:apply-now','Link','onClick');">
<img src="/images/GICs/applynow-button.gif" border="0" alt="Apply Now" /></a>
Assuming your button is rendered with a component template, it seems like you need to just use the Ordinal Position of the component on the page - Can you specify what kind of templates you are using (VBScript or Modular with DWT or C#)? Base on that we may be able to give you some code samples.
Graham bird has a good article about OrdinalPosition with VBScript at: http://www.grahambird.co.uk/2011/01/ordinalposition/
The idea behind this is that you add the ComponentPresentation.OrdinalPosition value to your analytics code.
The main page of our website is HTML. The powers that be want to put an asp.net calendar on this main page. Is there any better way to accomplish this than to use an iframe?
Start with this...
<div id="calendar">
View our calendar
</div>
Then use an AJAX request to replace the link with the actual calendar... works whether or not JavaScript is enabled / successfully fires!
Here is the jQuery way of getting the calendar...
$("#calendar").load("/ajax/calendar/");
I recommend that the first URL (the link to the calendar) links to a full page containing the calendar and the second URL (the link to ajax/calendar/) links to something that just returns the HTML for the calendar, to make it faster and less bulky...
All URLs are fictitious and any resemblance to your real URLs is purely coincidental.
If you control IIS - you could just map .HTML to the ASP.NET handler and add your asp:calender wherever you want.
If you're able to use JavaScript, then I would recommend one of the plethora of JavaScript calendars out there.
http://jqueryui.com/demos/datepicker/