Questions tagged [razor-3]

Version 3.0 of the ASP.NET Razor view engine used to create dynamic web pages with the C# or Visual Basic .NET programming languages.

ASP.NET Razor 3 includes the following new features:

Support for Tab editing. Preivously, the Format Document command, auto indenting, and auto formatting in Visual Studio did not work correctly when using the Keep Tabs option. This change corrects Visual Studio formatting for Razor code for tab formatting.

Support for URL Rewrite rules when generating links.

Removal of security transparent attribute. Note: This is a breaking change, and makes Razor 3 incompatible with MVC4 and earlier, while Razor 2 is incompatible with MVC5 or assemblies compiled against MVC5. Sources: http://www.asp.net/visual-studio/overview/2013/release-notes#TOC14 https://en.wikipedia.org/wiki/ASP.NET_Razor_view_engine

24 questions
56
votes
5 answers

Correct, idiomatic way to use custom editor templates with IEnumerable models in ASP.NET MVC

This question is a follow-up for Why is my DisplayFor not looping through my IEnumerable? A quick refresh. When: the model has a property of type IEnumerable you pass this property to Html.EditorFor() using the overload that only…
GSerg
  • 76,472
  • 17
  • 159
  • 346
19
votes
2 answers

What's new in Razor 3?

I can't find what's new in Razor 3. It seems like a silly question, but I can easily find what's new in MVC 5, in EF 6, etc. - but I tried to google it, I tried asp.net, I tried Scott's blog - nothing. So I'm curious, does anyone actually know…
Robert Goldwein
  • 5,805
  • 6
  • 33
  • 38
7
votes
2 answers

Identity 2.0: Creating custom ClaimsIdentity eg: User.Identity.GetUserById(int id) for Per Request Validation

See this similar question: Need access more user properties in User.Identity I would like to create custom authentication methods to use with my Razor Views that allows easy access IdentityUser properties relational to the User.Identity object but I…
6
votes
0 answers

View Class Library // Razor Intellisense

I want to create a usable View class library, including views using Razor. I have troubles to implement Razor Intellisense in my views. I have already done a lot of research to find a solution, including this blog :…
Glad
  • 147
  • 1
  • 11
3
votes
0 answers

Unable to find a version of 'RazorEngine' that is compatible with 'Microsoft.AspNet.Razor 3.2.2'

I try to update Nuget to my ASP.NET MVC5 project and the Razor cannot be resolved. Attempting to resolve dependency 'jQuery (≥ 1.9.0)'. Attempting to resolve dependency 'Microsoft.Web.Infrastructure (≥ 1.0.0)'. Attempting to resolve dependency…
Tomas Kubes
  • 23,880
  • 18
  • 111
  • 148
3
votes
2 answers

Add prefixes to id's and names of viewmodel fields

In my project I use a lot of views/forms that are loaded dynamically. In my forms there are a lot of fields generated by using @Html.TextBoxFor() and then @Html.IdFor(), @Html.NameFor() are used in my javascript logic. Some of my view models have…
Maksim Vi.
  • 9,107
  • 12
  • 59
  • 85
2
votes
2 answers

MVC5 relative path not working

I update my web application to MVC5. Since it requires Razor 3.0 then I updated it as well. Suddenly relative paths are not resolved anymore, in _layout.cshtml a link like this: is ok while…
Zirc75
  • 365
  • 3
  • 13
1
vote
1 answer

How to add Class to SelectListItem in ASP.NET MVC5 Razor Syntax?

I created a select input field using the Razor. Given below is the code: @Html.DropDownList("selectOption", new[] { new SelectListItem() { Text ="Option 1" , Value = "1" …
1
vote
1 answer

Call an Action using Ajax.ActionLink does not work

I have a really weirdo issue, I write : @Ajax.RawActionLink( "", "CustomerOrder", "PrintSheet", new AjaxOptions() { UpdateTargetId = "bodyContent", InsertionMode =…
BeSome
  • 15
  • 5
1
vote
1 answer

How can I avoid duplicate rows from near-simultaneous SQL adds?

My Razor 3 web app is creating multiple rows for the same foreign key Id, when multiple input comes in for the same Id, and I would like help on how to avoid this. The SQL Server table stores data about records in another table (it's ratings users…
Dronz
  • 1,970
  • 4
  • 27
  • 50
1
vote
1 answer

Missing razor intellisense and keyboard shortcut behavior in MVC 5 - visual studio 2012 with Resharper

I have started an MVC 5 empty project and imported most of my stuff from another project to this one using most of this link. However I soon found out that I was having other kinds of troubles. I have since then downloaded ASP.NET and Web Tools…
hsim
  • 2,000
  • 6
  • 33
  • 69
1
vote
1 answer

@Html.DropDownList fails to initialize value

I have a simple piece of code that tries to populate a list of 3 countries and select the 2nd item by default. For some reason, @Html.DropDownList is not initializing the 2nd item in the screen. Can someone point out whats wrong with this code…
0
votes
1 answer

Is it possible to match all subdirectories by a PageRoute or convention in Razor pages?

I'd like to use same page for all subdirectories in Razor pages. I have this in startup: services.AddRazorPages(options => { options.Conventions.AddPageRoute("/test", "{path?}"); }); But this only matches first subdirectory, such as test/my. Is…
Luka
  • 1
  • 3
0
votes
1 answer

How to activate cors in a asp.net website (razor 3)

I am pretty new to ASP.NET Website programming. I have an node js express application where I need to make requests to. This currently doesnt works from my asp.net site because i dont have cors enabled. I hope you can help me and if I am just beeing…
Fab
  • 1
0
votes
0 answers

compare two form variables and disable submit button

I'm trying to compare two values of a form. And if they are equal I want to disable the submit button and perhaps display a error field. The focus should be on disabling the button though. In the code below there is a m.loadingtill and m.loadingfrom…
S B
  • 309
  • 2
  • 9
1
2