I am working on a Web Api application and below is the razor templates used in my code.
Image
The _layout.cshtml page contains footer which needs to be shared across the other templates. Below is the footer to be shared across templates.
<p> This is footer </p>
I have tried using the following to share the footer but it is not rendering the page.
#model SR.Services.External.Data.EmailNotificationModel
<html>
<head>
<title></title>
</head>
<body style=\"color:#808080;font-size:8pt;font-family:Arial\">
<p>
Hi #Model.TargetUserName,
</p>
<p>
You have been removed from community '#Model.ObjectName' by #Model.Initiator.
</p>
#Html.Partial("_layout.cshtml")
#Html.Partial("~/EmailTemplates/_layout.cshtml")
#RenderPage("~/EmailTemplates/_layout.cshtml")
#RenderPage("_layout.cshtml")
</body>
</html>
Any help is appreciated.
Related
I have a Blazor WebAssembly Hosted Application. My intention is to use Server for some of the site and WebAssembly pages for the remainder so they can run off-line.
I have what should be a simple question about the Server side.
I have the following:
Pages/_Layout.cshtml
Pages/Index.cshtml
Pages/Components\MyComponent.razor
/Pages/_Layout.cshtml
<!DOCTYPE html>
<html>
<head>
<title>#ViewBag.Title</title>
<link href="/lib/twitter-bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<base href="~/" />
</head>
<body>
<div>
The Layout Header
WHAT MAGIC GOES HERE TO INSERT MyComponent.razor
</div>
<div class="m-2">
#RenderBody()
</div>
<script src="_framework/blazor.server.js"></script>
</body>
</html>
/Pages/Index.cshtml
#page
#model MyApp.Server.Pages.IndexModel
#{
}
<h1>Index Page</h1>
/Pages/Components/MyComponent.razor
<h3>My Component</h3>
My output is:
The Layout Header
The Index Page
I want:
The Layout Header
My Component
The Index Page
How do I add that razor component to my _Layout.cshtml page?
Your _Layout.cshtml page is a Razor Pages page, right? So you can use the component Html tag to render a Blzor component in your Razor Pages page, something like this:
<div>
The Layout Header
WHAT MAGIC GOES HERE TO INSERT MyComponent.razor
<component type="typeof(MyComponent)" render-
mode="ServerPrerendered" />
</div>
Note that the above requires you to set some configuration for this to work.
#using CaptchaMvc.HtmlHelpers
<!DOCTYPE html>
<html lang="en">
<head>
#Scripts.Render("~/bundles/jquery", "~/bundles/modernizr")
#Scripts.Render("~/bundles/jqueryval")
#Scripts.Render("~/bundles/bootstrap")
#Styles.Render("~/Content/css")
</head>
<body>
<div>
<div>
#Html.Captcha(4)
<p class="Error"> #ViewBag.ErrMessage </p>
</div>
</div>
</body>
</html>
I am using simple captcha in login page but when application loads first login page captcha image not showing
You need to be registered, and have some specific code that you can get by going to the link below:
Recaptcha Solution here!
I just started learning html from Bindner's book (A Student's Guide to the Study, Practice, and Tools of Modern Mathematics), which has a chapter on it.
I wrote the code
<html>
<head>
<title> My Page <\title>
<\head>
<body>
<p> Hello everyone! <\p>
<\body>
<\html>
in notepad++ and saved it as my site.html. But when I opened it in browser, a blank page shows up. What am I doing wrong?
not \ but / in close tags.
<html>
<head>
<title> My Page </title>
</head>
<body>
<p> Hello everyone! </p>
</body>
</html>
"This won't transfer to the FileZilla correctly from Notepad++ the images won't show? I asked the teacher for help, but he doesn't know the material well enough to trouble shoot the problem. Internet Explorer will run the module and the text runs just fine, but Google Chrome say Error 2, and FileZilla won't register the pictures, they only show as black box icons, pls help"
<html>
<head>
<img src="images/images12.jpg" style="padding:6px" align="center" height="400px" width="400px">
<style>
#this is the set up for the text body {
font-family: Papyrus, fantsy;
text-align: center;
}
h1 {
font-family: Papyrus, fantsy;
text-align: center;
}
h2 {
font-family: Papyrus, fantsy;
text-align: center;
}
</style>
header for the home page
<title> Woody's Wondering's</title>
<header>
<h1>Which way did Woody Go?</h1>
</header>
<nav>
<b>
Home
Places To Go
Whats Free
<br>
<br>
Kids....Cheap easy Fun!
<br>
Adults Only
</b>
</nav>
<main>
<h2>You Next Adventure is only a click away!!!</h2>
<p>Welcome to Woody's Wonderings were everything is cheep and easy to find in Ohio.....How Cheap, well pracically 20 dollars to free. </p>
<h2>Meeting all your fun fun needs!!!</h2>
<p>Keeping the site updated with new and improved places & Events year around
</p>
</main>
<footer>
<small><i>
Jessica Harper</i></small>
</footer>
</body>
</html>
Your image is in the head of the html document. Correct structure for html is,
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>The HTML5 Template</title>
<!–– Style sheets & other importations go here ––>
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<!–– Your content goes here ––>
<!–– Javascript files go here ––>
<script src="js/scripts.js"></script>
</body>
</html>
From w3schools,
The element is a container for metadata (data about data) and
is placed between the tag and the tag.
HTML metadata is data about the HTML document. Metadata is not
displayed.
Metadata typically define the document title, character set, styles,
links, scripts, and other meta information.
But I tested myself, and the images do work if the image exists in the path. Please check the image exists in the location you have in the img tag.
I am assuming you have uploaded the images along with the html file. If not please upload the images through filezilla to the correct location.
The best way to find what is the issue is to check the browser console. You may find an error saying no image found in path/to/your/image and that is where you have to put your image!
Your HTML is malformed and does not have an opening <body> tag, which could be causing some issues. I'd recommend using the W3C HTML Validator to validate your code.
Errors like this are easier to visually spot if you use some sort of code-formatting/"pretty-print" tool (I like this one).
Notepad++ probably has a plugin for this as well.
I am working with a very big HTML file, which has a lot of content in the body section.
Are there any "compilers" or merging applications for HTML that can merge multiple HTML files?
Example:
a.htm
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
</head>
<body>
INCLUDE "b.htm"
<div>
INCLUDE "c.htm"
</div>
</body>
</html>
b.htm
some text
Link
INCLUDE "c.htm"
c.htm
more <span>text</span>
would be merged to:
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
</head>
<body>
some text
Link
more <span>text</span>
<div>
more <span>text</span>
</div>
</body>
</html>
There are indeed – depending on your needs these offer drastically different mechanisms and tools.
One particular quite simple HTML compiler that is fashionable at the moment is Jekyll. Jekyll powers the blogging engine on GitHub Pages and is both easy to use and extensible.
In your case, you’d for instance write
{% include c.htm %}
instead of
INCLUDE "c.htm"
I decided to write htmlcat for exactly this purpose.