Blazor layout tag not rendering page correctly - razor

I am making a website using Blazor/razor where the login page has a different layout than my default layout. I know I have to use the #layout tag at the top of the page to specify that I am using a different layout, but the problem is that when the page opens, it seems as if the default layout is used for a split second before it changes to use my specified layout. Any suggestions as to how to stop that from happening?

The issue was the call for await base.OnInitializedAsync() was being done in the incorrect order. In my MainLayout.razor file, there is an OnInitializedAsync method containing the aforementioned await call. I also have some logic checking if a user has been authenticated to use the website (logged in), to be redirected to the loggin page if not. By making sure that the await base.OnInitializedAsync() call is after that logic, the page stopped rendering the incorrect layout before loading the "overridden" layout. From what I can gather, this is because the await call contains the base keyword which has something to do with layouts, so having this call before my redirection logic was initializing the page and rendering the default layout of the page before any logic was done.

Related

TYPO3 Ke_Search: How do I have multiple search forms on one page without them interfering each other?

I have a search form in my header rendered as a cObject from a content element which is a ke_search searchbox and it leads to a /search page when submitting.
I also have subpages that are supposed to only look through seperately indexed pages like news and other pages.
For that I have folders in the typo-backend which contain indexer configs.
My problem is that when I set up that search box in the header the other searches are using the indexer config from the header (probably because it's the first searchbox on that page).
How do I make sure that every searchbox uses it's correct index?
As mentioned: Everythings seems to be split up nicely in the backend.
I can only imagine that somethings going wrong because the searchboxes are rendered with the same id but how can I make sure they render with diffrent ID's?
I managed to get an answer from the team behind Ke_Search.
When implementing a global searchbox that is used across every page, you should implement the searchbox as plain html and not as a content element in Typo3. You can only have one searchform as a content element per page.
Here's the documentation on how to implement the html version:
https://docs.typo3.org/p/tpwd/ke_search/main/en-us/Templating/Searchbox.html#include-searchbox-with-plain-html
Just leaving this here for anyone running into the same issue.

Programatically modifying a HTML page from ASP.NET

I have an ASP.NET web app with a standard default.aspx, from within which I need to load a html page from another site (all internal intranet) and pre-populate form input controls on that loaded html page using ASP variables. Specifically, username / pwd on a login form based user details loaded by the aspx from a db. The html page also contains a considerable amount of js (shouldn't directly impact this question though).
Not sure of the best route to approach this. I have considered:
1. Loading the html page in a frame, then somehow manipulating it's DOM from another frame loaded from the aspx.
2. Loading the html during aspx page load or render, then replacing the relevant sections of the html with the new values.
I have had a stab at both approaches and ran into issues. With (2) the resulting HTML isn't recognized as HTML by the browser at all (despite the written response being just the original html relayed from the original site). I can see the HTML source in the browser, but the page itself appears blank.
Answers warmly anticipated. Thank-you.
1.if you want to go wityh iframe
You can easily modify values from communicate between parent window and iframe
from parent to iframe function
document.querySelector('iframe').contentWindow.ChildFunction(33);
from chhild to parentfunction
parent.parentfunction("4rom child")
make a function in iframe that accept an object (from parent) and populate it in.
make a function in parent that accept an object (from child) .
2.how are you "Loading the html during aspx page load or render,"
- ajax or something else?
-making a user controll
both should work fine .
( could you tell how are you loading html ?)(as it should have worked)

Including an HTML file in another HTML file

I am creating a personal learning website. It will contain many "lessons" and I would like to be able to use a menu for every active "lesson", so that the user could go to the next "lesson" without going back to the menu to select it.
To do that, I would need an extern file to modify once and for it to be "called" on every "active" page on the website.
I tried using the -object tag- in html, but it does not work with the template i am using and I would still have to modify the size of the window on every page it appears in.
For some unknown reason, I could not make the third-party method shown on w3s work, and neither the jQuery method I found on similar questions.

Preview amp generated pages to my browser

My web app generate an amp-valid page and via https://validator.ampproject.org/# I can check that the output is amp- valid.
But for me is not enough I want somehow to render visualy the <amp-*></amp-*> elements. I mean if I want to chance some css for these elements how I can do it without deploying my application all over the time?
Some elements may not be rendered because they need the correct amp extention in order to load. Therefore if some elements do not get rendered just load the correct amp.js extention in order to get rendered into your browser.
Furthermore make sure that the AMP javascript and their plugis get loaded firtst in order to be able to correcly get rendered.

Blogger no longer respects the chosen dynamic view

I have a Blogger site with CSS customized dynamic view template, where each section on the menu had a default view (magazine, flipcard, mosaic).
I say "had", because recently I've noticed that Blogger does not longer respect the choosen view, when passing from one section to another which has a different view (for example url: from ?view=mosaic to ?view=flipcard). I wonder if anyone has encountered the same problem, or if there is a way to "force" a certain view, as formerly.
I'm no expert at all, but i think the fastest solution should be finding a way to 'force' the browser on refreshing the URL query strings. For example, when I navigate from
www.alesserfate.com/search/label/audioKB?view=timeslide
to
www.alesserfate.com/search/label/videogame?view=mosaic,
, and then back to the first link, the URL query "?view=timeslide" seems to be overridden and the page is displayed with the (wrong) mosaic view.There must be a way to fix this ("forcing" to refresh url query?). I want to emphasize that, this behaviour is NEW ,without touching anything on the blog. Definitely Google has changed something under Blogger's hood.