I'm developing a MVC3 base website and I am looking for a solution for handling errors and Render custom Views for each kind of error. So imagine that I have a "Error" Controller where his main action is "Index" (generic error page) and this…
Very simple question: Are controllers in ASP.NET created for every HTTP request, or are they created at application startup and reused throughout requests?
Will the controller be created only for a particular HTTP request?
If my previous assumptions…
If I write like this:
form action="Images" method="post" enctype="multipart/form-data"
it works.
But in Razor with '@' it doesn't work. Did I make any mistakes?
@using (Html.BeginForm("Upload", "Upload", FormMethod.Post,
…
In my cshtml files I have a lot of blocks with stuff like this:
@if(Model.foo)
{
Hello World
}
The only reason the span is there is because I can't find any other way to force it to recognize that "Hello World" is part of the html…
In my MVC application, I am using following code to upload a file.
MODEL
public HttpPostedFileBase File { get; set; }
VIEW
@Html.TextBoxFor(m => m.File, new { type = "file" })
Everything working fine .. But I am trying to convert the result fiel…
I'm trying to get an ASP.NET MVC 3 site running on IIS 6.0.
Currently when I request a page from the server it gives the following error:
Parser Error Message: This method cannot be called during the application's pre-start initialization…
I'm using MVC 3 in my project, and I'm seeing a very strange behavior.
I'm trying to create a hidden field for a particular value on my Model, the problem is that for some reason the value set on the field does not correspond to the value in the…
I created a new app with VS 2015 RC and the MVC template and without modifying any line of code I have this error:
Method not found: '!!0[] System.Array.Empty()'.
Description: An unhandled exception occurred during the execution of the current web…
How do I create a readonly textbox in ASP.NET MVC3 with the Razor view engine?
Is there an HTMLHelper method available to do that?
Something like the following?
@Html.ReadOnlyTextBoxFor(m => m.userCode)
I have a View - _Edit which lives in News M/V/C.
I reuse the V/M via the CategoryController as:
return PartialView("/Views/News/_Edit.cshtml", model);
How from within the View - _Edit can I alert the controller name?
When I:
alert('@ViewContext.…
I have a MVC3 site in C#, I have a particular view being fed query parameters from a JavaScript function, the function redirects to the site via
window.location.href = "../ActionName?" + query_string;
query_string being the dynamic query…
Bounty
It's been awhile and I still have a couple outstanding questions. I hope by adding a bounty maybe these questions will get answered.
How do you use html helpers with knockout.js
Why was document ready needed to make it work(see first edit…
I have code in the global.asax file's Application_Error event which executes when an error occurs and emails details of the error to myself.
void Application_Error(object sender, EventArgs e)
{
var error = Server.GetLastError();
if…
On my MVC3 project, I store score prediction for football/soccer/hockey/... sport game. So one of properties of my prediction class looks like this:
[Range(0, 15, ErrorMessage = "Can only be between 0 .. 15")]
[StringLength(2, ErrorMessage = "Max 2…