Adding HTML5 markup to a MVC3 site - visual-studio-2010

I have already created a MVC3 site but when I did I didn't select the HTML5 markup option. I would like to add some 'safe' HTML5 markup into the MVC3 site unless there is a way to convert the project to use HTML as if I had selected it from the start (is that possible?).
Would I be safe changing the _layout.cshtml to use HTML5 markup such as nav? How do I use my current CSS style sheet to make sure it positions it correctly (is it as simple as adding the class)?
I understand you can select the 'Target Schema For Validation' option to HTML5. Is that mainly for intellisense? Is this one of the primary bi-products of selecting the HTML5 option at project creation time or are there many more impacts other then this target schema and the _layout page?
Thanks much in advance!

There is no magic to the HTML5 support in MVC3. The checkbox in the project template dialog simply creates a different _layout file with <nav> instead of <div>, a reference to modernizr.js, etc. You're free to change the markup of the _layout file to whatever you like.
The schema validation dropdown simply governs what code completion options you get from Intellisense, and what warnings you get when adding markup that does not conform to the schema. But again, if the HTML5 standard gets updated with new tag next week, and Microsoft fails to update Visual Studio, you're free to add markup that doesn't conform to the VS schema.

Related

Render DevExpress XtraReport template as HTML

We are using DevExpress DX.10.2. Our client has asked to be able to view the XtraReport templates (not the report itself, just the template) within an MVC 3 application that we maintain for them.
My first thought was that I'd have to fake the data to look like the "template" and show the actual reports. However, I noticed in Visual Studio that the XtraReport designer has an "HTML View" option that renders the template in HTML.
I would think that if DevExpress is able to render the template as HTML in the designer then it's likely that there's a way to extract that HTML to render on a view. Is there a way to extract HTML from an XtraReport template?
Thanks!
Stumbled across the solution. Had to add a reference to DevExpress.XtraReports.Web and then the following line writes the report HTML to the response stream:
XtraReport1 report = new XtraReport1();
DevExpress.XtraReports.Web.ReportViewer.WriteHtmlTo(System.Web.HttpContext.Current.Response, report);

Design View for ASP.NET MVC3 Views

Is there a Design View in ASP.NET MVC3 ?
There is no 'Design' view in MVC, like there is in Forms. However your views are just HTML so you can use any HTML editor, although they will not be able to interpret the Razor syntax.
What most people do is make changes to the HTML, save (you don't have to recompile,) and refresh your browser. Google Chrome has a very help full tool built in (Firebug or something like it.) Just right click on the page and select Inspect Element. This will come in very handy.
Also one thing to think about since you're new to MVC is that you can easily use most any css themes that you can find online to make the site look very different out of the box.

MVC Razor GUI and Coder Working Together

I would really like to use the MVC and Razor technology for my web application. The problem I am running into is that I am the coder and will be working with a HTML GUI designer.
I only see 2 ways for the GUI person to work at this point.
Install Visual Studio and open the whole solution and work like I am working, except he would stick to the CSHTML files.
Use his favorite HTML editor or notepad and edit the CSHTML files manually and then also have something like IIS Express installed with the app configured so that they can refresh the page they are working on.
Neither of these seems productive or intuitive. I would love to see the GUI person able to use a tool like Expression Web or other tools that allow you to see the design and html at the same time. Having tools available for shading and colors and positioning would be good.
Now I understand why it is this way. It is because of the processing that Razor does to render the pages. This is most true by the fact that most of the cshtml pages themselves are not complete pages. They are meant to live inside of a _layout page.
Isn't there something, though, that can at least show the basic rendering during editor?
What are other people doing?
You have a few options. AFAIK there is no WYSIWYG HTML editor that understands Razor. So, either your designer must work in straight html, or...
1) The designer works in pure HTML files. They give you those files, and you adapt them to Razor. If they need to make changes, you can track those changes with a diff tool (from the previous version) or use a version control system to compare versions of the raw html. Then you apply those changes to your Razor files.
2) Your designer works in .aspx files, which Expression Web understands. You could convert the WebForm syntax to Razor syntax. Again, you are spent doing lot of work, but probably less work than the pure HTML way of doing things, because the designer will have designed the code for master pages. These can be relatively easily adapted to Layouts.
It would be nice if the next version of Expression understands Razor.

Dev Express MVC Extensions with Razor - Controls Show as Lists

Any DevExpress control I use, just renders a list. I’ve tried all 3 possible syntaxes (listed on the site below) and every time, the control I want to use (TreeView, NavBar, etc.) just renders as a bulleted list. Any ideas why? I’ve checked Google and the DevExpress support center, but I can’t find any issues like this.
DevExpress with razor guide: http://documentation.devexpress.com/#AspNet/CustomDocument9944
I just put this code on my index page to test that DevExpress is working:
#{Html.DevExpress().NavBar(settings => {
settings.Name = "myNavBar";
settings.Groups.Add("Group1").Items.Add("Item1-1");
settings.Groups.Add("Group2").Items.Add("Item2-1");
settings.Groups.FindByText("Group2").Expanded = false;
}).Render();}
When it reaches the page, it just shows a bulleted list:
Group1
Item1-1
Group2
Any ideas what's causing this?
The project I was working on was being rendered inside another project. I just needed to get rid of my project's layout and add using statements to the cshtml pages:
#using DevExpress.Web.Mvc.UI;
#using DevExpress.Web.Mvc;
The only problem I still have, is the scriptlet code gets highlighted red (but it builds/works fine and has intellisense).
It seems that any required DevExpress' entry is not registered within the MasterPage (_Layout.cshtml) / Web.config http://help.devexpress.com/#AspNet/CustomDocument8163. I suggest that you use specially designed Visual Studio Project Templates http://help.devexpress.com/#AspNet/CustomDocument9145 to avoid missing any required DevExpress' entry.

SharePoint 2007 RichHtmlField has inline style that is causing issues in ie8

I am working on an intranet project that is having the majority of its users move up to ie8 soon. A bug was detected where when attempting to create/edit a page, the rich html editor boxes would be squeezed compared to what they look like in any other browser.
I found the offending style, its inline and its:
style="display:inline-block"
Now if it was just "inline" then it would be fine. However, it is not.
I have attempted to override the PrefixStyleSheet attribute in the master page and have a custom style in the main css file, but it is not working at all.
I have heard that a control adapter might be helpful to post process the html but i am unsure on how to use one.
Is there any advice you guys can give me?
From my experience, using JQuery "hacks" in the master page header is the most convenient approach, without messing up the system css or the backend.
Find the element you want to override the style to a custom style, and assign your custom style. Be careful if the override is page layout specific, then might add to the page layout header placeholder instead.
http://api.jquery.com/css/
Hope it helps.

Resources