Each time I use Visual Studio to generate a display-template using scaffolding I get something like this:
<fieldset>
...
<div class="display-label">Property</div>
<div class="display-field">#Model.Property</div>
...
</fieldset>
Is there any way to change this template so that it use a HTML definition list instead?
<dl>
...
<dt>Property</dt>
<dd>#Model.Property</dd>
...
</dl>
I know you could use DisplayTemplates, but I want the generated code to be default in all my projects.
Take a look at the following post: http://weblogs.asp.net/scottgu/archive/2009/01/27/asp-net-mvc-1-0-release-candidate-now-available.aspx. It describes customizing the templates. While it was written about Mvc 1 everything still applies
If you are having trouble finding the item templates you can add them to your project with Nuget: http://blogs.msdn.com/b/joecar/archive/2011/01/06/add-the-asp-net-mvc-3-code-templates-to-your-application-with-nuget.aspx
You can accomplish this through T4 templates. Take a look at the explanation in this thread. How do I create my own Scaffold Template in ASP.NET MVC 3?
Related
I am working on a project using ASP.NET CORE with MVC and when I want to use bootstrap (i think?) I get this warning, on a video on youtube he could see the B from bootstrap (autofill thing) when he used the div class name... but I don't get it and I see that bootstrap is loaded into my project.. I don't understand I followed the exact same instructions of the guy but mine just don't work.. I am beginner to visual studio and programming so I struggle with it.. thanks in advance..
The tag name should be div, instead of div-class.
<div class="row>
</div>
I google a lot and find many solutions, but none of them is working for me. I try to make a project in visual studio 2015 (asp.net core). In given image I want to include header.html in index.html page. How can I do it? Thanks in advance.
There are many solutions but not for HTML, but other technologies like ASP.NET MVC or AngularJS.
You try this solutions for simple HTML.
http://www.w3schools.com/howto/howto_html_include.asp
#Html.Partial("~/Views/CommonHtml/header.html")
Please see:
What to use instead of WebViewPage.RenderPage method in ASP.NET 5 MVC6
In APS.NET MVC you have several options how to achieve this:
using master page approach
#RenderBody() <!-- in master -->
#{ Layout = "~/Views/Shared/master.cshtml" } <-- in child -->
Use partials
#Html.Partial("Partial")
Here find more information about:
https://learn.microsoft.com/en-us/aspnet/core/mvc/views/partial
https://www.asp.net/mvc/overview/older-versions-1/views/creating-page-layouts-with-view-master-pages-cs
I am using Kentico and have noticed a weird css issue. After mocking my pages up in Dreamweaver I then create the page in Kentico, however I have noticed that some elements in Kentico are slightly misaligned.
I have tried copying the source from Kentico into Dreamweaver to see if I can fix the issue but Kentico still renders the content incorrectly.
Are you using Dreamweaver in design or split mode? if yes, turn it off and use code mode only.
I guess you have to compare structure of your HTML and Kentico output HTML. Kentico add a form tag by default which may cause structural issue with css. If you can provide both html, I can help
On Kentico (up to version 11) when you use portal engine or ASPX templates you have this shortcoming. Kentico adds excessive HTML markup on the controls it creates on order to provide hooks that will help the engine to perform actions. For example, Bizforms add multiple divs/spans around normal input tags. So, you have to adapt the CSS you have created to match the tags used by Kentico.
What is your template type:
ASPX page: You can copy your entire HTML code from Dreamweaver into your aspx page template and then work on your page.
Portal Page: You need to understand the structure and cannot replace entire HTML Code from Dreamweaver. You have to seperate your HTML code to insert DropZone for web parts and widgets.
Good Luck!
You will have to make some adaptation always from raw HTML and kentico. In your case you are using aspx model which makes it more harder as server level changes are not 100% compatible with raw HTML or client side code. If possible use portal engine with transformation which will be more like to like of raw HTML.
You must create a directory in CSS/Stylesheet
If you're using the CSS section of the Admin interface, check to see if you have any & signs at the beginning of any tags. Kentico doesn't seem to support this so might be breaking any classes that appear after it.
I'm building a multi-tenant application that allows a tenant to edit the layout (HTML) on the UI in the administration control panel. I thought that I can build an editor for user to edit the razor view but It's need to be compiled to effect the new razor view.
I look into some open source applications. I find this one http://liquidmarkup.org/ It was developed for usage in Ruby on Rails web applications
Anybody have any experience & reference for this in ASP.NET MVC?
Not 100% sure if this is what you are looking for but you could develop your site using jQuery themes (CSS and markup) and then use the theme roller for your clients?
It sounds like you can use Jquery Templates (http://api.jquery.com/category/plugins/templates/) to meet your need.
Here is a random (greatly condensed) sample template from one of my projects:
<table>
<tr>
<th>Response Status</th>
<th>Response Reason</th>
</tr>
<tr>
<td>${RepsonseStatus}</td>
<td>${ResponseReason}</td>
</tr>
Note the ${} tags - these will be replaced with json data at runtime.
And here is how to merge a template with its data
//myTemplate can be sent from a server side function
var myTemplate = SomeFunctionToGetMyTemplate();
//myData is a javascript object/json from the server
var myData = SomeFunctionToGetMyData();
//the html function just replaces the html of the context node (#myTargetDiv) with the //output of the $.tmpl function
$("#myTargetDiv").html($.tmpl(myTemplate, myData));
Jquery Templates are officially deprecated, but there is no official replacement from jquery yet (afaik). There are some helpful video tutorials on pluralsight for jquery templates.
Highwire.com is built on ASP.NET but they use custom templating and custom UI abilities for clients using Apache Velocity Platform.
http://docs.highwire.com/apiv2/html/
Maybe you could use it as well
I have been looking for a way to embed a dynamic page into the view of another page. In the Struts world, I would use the s:action tag to embed an action into a page. What would be the equivalent in Spring MVC?
EDIT : Found the answer...duplicate of How to include a controller from jsp page
Better than using import like the solution you posted would be to use Apache Tiles or other framework like it.
So you can use templating and create the page dynamicly inserting content when needed, like menus, content, header, footer etc...