I am using Asp.net MVC. In the layout page I want to store footer in a file and call it using RenderPage. It looks that everything is OK but when I run the website I get this error:
this is the file tree for project
_Footer.cshtml is located in Shared Folder
content for _Footer.cshtml
<div id="copyrights">
<div class="container clearfix">
<div class="col_half">
</div>
</div>
</div><!-- #copyrights end -->
In ASP.NET MVC you can use
#Html.Partial("_Footer") or #{Html.RenderPartial("_Footer");}
Related
I have a <form> where I am using Vue.js and Quasar, and submits in as a HTML form in asp .net core 3.1
The problem is when I am using Quasar Uploader (https://quasar.dev/vue-components/uploader).
The functionality works fine, but when I submit the form (post i C# and .net core).
I cant get the the file in the controller.
As you can see from this example: https://codepen.io/cbrown___/pen/GRZwpxw
When the Uploader is rendered it does not have the attribute name. From the example above you have this input:
<input tabindex="-1" type="file" title="" class="q-uploader__input overflow-hidden absolute-full">.
I guess that is why I cant get it from my Controller. How can I solve this when I am using .net Core 3.1 to submit this form?
And I see no good solutinos in letting people upload files through my API before the record is created.
Is it a option here I do not see?
EDIT:
The <input> is on the plus-icon. So by using inspect elements you should be able to see that no name occurs.
EXAMPLE CODE:
HTML
<div id="q-app">
<div class="q-pa-md">
<div class="q-gutter-sm row items-start">
<q-uploader
url="http://localhost:4444/upload"
style="max-width: 300px"
></q-uploader>
<q-uploader
url="http://localhost:4444/upload"
color="teal"
flat
bordered
style="max-width: 300px"
></q-uploader>
<q-uploader
url="http://localhost:4444/upload"
label="Upload files"
color="purple"
square
flat
bordered
style="max-width: 300px"
></q-uploader>
<q-uploader
url="http://localhost:4444/upload"
label="No thumbnails"
color="amber"
text-color="black"
no-thumbnails
style="max-width: 300px"
></q-uploader>
</div>
</div>
</div>
JS:
new Vue({
el: '#q-app'
})
If any body else need this I ended up with using this:
:name="'file_description[' + index + ']'"
That way each one got one name...and from another array I knew how many file_description it would be.
my html code:
<div class="header"></div>
<div class="tiles"></div>
<div class="list"></div>
<div class="footer"></div>
changed to:
<div class="header"></div>
<div class="content">
<div class="tiles"></div>
<div class="list"></div>
</div>
<div class="footer"></div>
I made a content div around tiles and list.
My problem is by doing that my html won't update in my browser.
and yes i already cleared my browser cache, I disabled caching in devtool.
I added no cache meta tag. I rebuild my solution, clean solution no luck. Whatever code i add or delete nothing happens. My css is updated not the html.
I tested it by just deleting my content and when I run my project I still had every content on my browser. What else can I do to fix this?
I have a C# MVC application with a pretty-much standard Bootstrap display.
As usual the Navbar is provided by Shared\_Layout.cshtml.
However one of my pages will only be used for generating a PDF using an HTML/PDF converter, so I don't want the Navbar to appear.
Is there a way to prevent this for specific pages?
I realised all I had to do was to add a querystring parameter that I can check for in _Layout.cshtml, i.e.:
<body>
#if(Request.QueryString["noheader"] == null)
{
<div class="no-print navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
...
I have an MVC 3 application that we run on our handhelds inside a web browser control. The devices run either CE5 or CE6.
When an image is requested on CE5, the image is displayed fine, but on CE 6 the image appears to download but doesn't actually appear until the page is clicked.
Once this happens, the image is cached (somehow) and is fine going forward for that session.
Has anyone else encountered this problem?
This is the only other page I can find that mentions the issue but no solution is mentioned:
http://social.msdn.microsoft.com/Forums/en-US/vssmartdevicesvbcs/thread/0396d869-2ac2-4d38-8565-2d308eb8573a/
EDIT:
The view code is below. Model.DisplayItem would return a string like:
~/Areas/R2D2Picking/Content/images/M00119.jpg
The actual images are on a separate drive (rather than part of the solution) so we access these by creating the folder structure in the solution, excluding this from the build and creating a virtual directory under the relevant root in IIS. We use this method in many of our applications so I don't believe that this would itself be an issue.
#using R2D2Picking.Models.ViewModels;
#using System.IO;
#using System.Net;
#model ItemImageVM
<div class='backImage'>
<a href="#Url.Action("PickSelectedItems", "Common")" onfocus="if(this.blur)this.blur()">
<img alt='' src="#Url.Content("~/Areas/R2D2Picking/Content/ButtonImages/BackButton.bmp")" /></a>
</div>
<div class='smallPrompt'>
<p>#Model.DisplayLiteral</p>
</div>
#if (Model.ImageExists())
{
<div class='itemImage'>
<a href="#Url.Action("PickSelectedItems", "Common")">
<img alt='' src="#Url.Content(#Model.DisplayItem)" /></a>
</div>
}
else
{
<div class='noImage'>
<a href="#Url.Action("PickSelectedItems", "Common")">
<img alt='' src="#Url.Content("~/Areas/R2D2Picking/Content/ButtonImages/no_picture.bmp")" /></a>
</div>
}
A sample image is below:
I've created a section for a footer in my asp.net MVC 3 Web Application:
<footer>
#RenderSection("Footer", true)
</footer>
This footer will be the same on every page, so it doesn't make sense for me to define it for each and every view. So, is there any way I can globally declare this footer section for all views? The footer will contain code so as far as I know it's bad practice, if not impossible, to directly define it in the .cshtml file.
Thank you in advance.
I have handled the same scenario by creating a partial view "_Footer" and place it on the "_Layout".
#ViewBag.Title
#Html.Partial("_Header")
<div id="content">
<div id="nav-bar">
#Html.Partial("_Menu")
</div>
<div class="container">
#RenderBody()
</div>
</div>
<div id="footer">
#Html.Partial("_Footer")
</div>
#Html.Partial("_Scripts")
Sure:
<footer>
#if (IsSectionDefined("footer"))
{
#RenderSection("footer")
}
else
{
... put your default footer here
}
</footer>
And in views that you want to override the footer simply define the section.
You can place the footer in your SiteLayout.cshtml. See this article for more information on using layouts with MVC 3.