tagged [razor]

Converting DateTime format using razor

Converting DateTime format using razor What is wrong with the following? @item.Date is showing 20/11/2005 12:00 a.m and I want to display 20 Nov 2011

13 Jan at 11:6

How to pass a value to razor variable from javascript variable?

How to pass a value to razor variable from javascript variable? How to pass a value to razor variable from javascript variable, is it possible asp.net mvc razor view engine?

4 Feb at 14:31

Writing/outputting HTML strings unescaped

Writing/outputting HTML strings unescaped I've got safe/sanitized HTML saved in a DB table. How can I have this HTML content written out in a Razor view? It always escapes characters like `

1 May at 16:30

What is the best way to migrate a MVC 2 project to MVC 3 using the Razor view engine?

What is the best way to migrate a MVC 2 project to MVC 3 using the Razor view engine? What is the best way to migrate a MVC 2 project to MVC 3 using the Razor view engine?

11 Jun at 20:24

How can I know if a non-required RenderSection exists?

How can I know if a non-required RenderSection exists? Is there any way to know in the `Omitted code` part if the RenderSection `Sidebar` exists or not?

MVC Razor @foreach

MVC Razor @foreach I heard that having @foreach inside of a view is a no-no. Meaning, the view should not have any logic in it. What is the best practice on where the logic for the @foreach should be ...

29 Jun at 12:57

Razor: No overload for method 'Write' takes 0 arguments

Razor: No overload for method 'Write' takes 0 arguments I get "No overload for method 'Write' takes 0 arguments" on the @{ i++; } line of code. Any thoughts? Thanks!

16 Dec at 23:46

c# razor url parameter from view

c# razor url parameter from view Why does `Request["parameterName"]` returns null within the view? I know I can get it from the controller but I have to make a little check in the View. I am using ASP...

29 Jun at 23:1

How can I create a SelectList with multiple selected values?

How can I create a SelectList with multiple selected values? I'm trying to set multiple values in a select list: What object/values do I use for to select multiple items?

10 Mar at 15:50

Possible to access MVC ViewBag object from Javascript file?

Possible to access MVC ViewBag object from Javascript file? Is it possible to do the following from a javascript file in an MVC application? Currently it throws the error: > reference to undefined XML...

Styles.Render in MVC4

Styles.Render in MVC4 In a `.NET MVC4` project how does `@Styles.Render` works? I mean, in `@Styles.Render("~/Content/css")` which file is it calling? I dont have a file or a folder called "css" insid...

25 Jan at 10:28

How can I apply styling to asp.net mvc @Html.TextboxFor?

How can I apply styling to asp.net mvc @Html.TextboxFor? I want to change the background of the textbox. This is my code: What more do I need to write in TextBoxFor to change the background?

4 Jul at 19:43

What is equivalent to clause between, for comparasion strings in LINQ or lambda expression of?

What is equivalent to clause between, for comparasion strings in LINQ or lambda expression of? How do I filter a query interval of two string using LINQ or Lambda Expression. example:

display line breaks asp.net mvc razor

display line breaks asp.net mvc razor I'm using the following to make the text output the line breaks entered in a `` HTML element. Is there a nicer way to do this?

mvc 3 Html.EditorFor add html attribute not work

mvc 3 Html.EditorFor add html attribute not work I try add html attribute for EditorFor But any way I get

7 Oct at 10:15

Use of await in Razor views

Use of await in Razor views Is it possible to `await` on tasks in Razor .cshtml views? By default it complains that it can only be used in methods marked with `async` so I'm wondering if maybe there i...

4 Oct at 13:23

Aspx to Razor syntax converter?

Aspx to Razor syntax converter? I have a considerable amount of ASPX and ASCX files writed in C# for MVC and I would like to convert them to the new Razor syntax. Any body knows about some utility tha...

7 Jan at 09:29

MVC which submit button has been pressed

MVC which submit button has been pressed I have two buttons on my MVC form: From my Controller action how do I know which one have been pressed?

4 May at 09:33

What is the difference between Razor and ASPX?

What is the difference between Razor and ASPX? Is there any difference between Razor and ASPX in a MVC project? Is it just about syntax? That's what I think after [reading this](http://weblogs.asp.net...

15 Jan at 21:22

How to get query string parameter from MVC Razor markup?

How to get query string parameter from MVC Razor markup? I want to check the URL parameter in my Razor markup. For example, how do I do something like this:

Action Image MVC3 Razor

Action Image MVC3 Razor What is the best way to replace links with images using Razor in MVC3. I simply doing this at the moment: Is there a better way?

21 Feb at 02:46

Current date and time - Default in MVC razor

Current date and time - Default in MVC razor When the MVC view page with this textbox, loads , I would like to display current date and time by default. How can I do this? in razor.

Specify size and maxlength for Html.TextBoxFor

Specify size and maxlength for Html.TextBoxFor I need to change the size of textbox : I tried this but doesn't work.

22 Feb at 13:47

asp.net mvc 3 razor. navigate to view on table tr click

asp.net mvc 3 razor. navigate to view on table tr click I have users list table how i can navigate on url: "../users/showprofile?userid=" I want to make table when user clicks on table row navigate on...

What is the @Html.DisplayFor syntax for?

What is the @Html.DisplayFor syntax for? I understand that in Razor, @Html does a bunch of neat things, like generate HTML for links, inputs, etc. But I don't get the DisplayFor function... Why would ...

15 Jun at 23:30