asp.net-mvc-2

CultureInfo issue with Modelbinding double in asp.net-mvc(2)

In my Jquery script I post two doubles using the browser's CultureInfo (en-UK) that uses the .as a fraction separator. My MVC app is running on a server with locale nl-BE using the , as a fraction separator. [AcceptVerbs(HttpVerbs.Post)] public JsonResult GetGridCell(double longitude, double latitude) { var cell = new GridCellViewMo...

asp.net mvc display collection in table with header

Hi, I just started doing some web development using asp.net mvc2. I am trying to find a way to display a collection of data in my view. Following is a very simple view markup to display the collection as a html table. my question would be what do people usually do when constructing table from a collection. How to handle the column hea...

Asp.net MVC jQuery ajax .post weird problem: post to server sometimes?

I've encountered a pretty weird situation, I'm using Win7, VS2010, ASP.NET MVC2, jQuery. I have a simple form a textarea and a button doing a .post() ajax call to server, pretty simple setup. It works when I input plain text in the textarea, but if I mix html tags like bold, then it works sometimes!! I do have [ValidateInput(false)] ...

Asp.net MVC 2.0 TempData expiration

What happens in Asp.Net MVC 2.0, when next request does not come ever to retrieve value from TempData. Is it stored permanently or expires? ...

How UpdateModel method fill FormCollection values to our instance ?

Hello everybody In this example how UpdateModel method fill person instance with formValues? I think UpdateModel use reflection while filling person by formValues but how updatemodel catch formValues parameter ? [HttpPost] public ActionResult Edit(int ID,FormCollection formValues) { Person person= db.PersonSet.Single(p => p.Perso...

Specify/Disambiguate editor field form names with EditorFor<T>

Hello, I am having a slight problem correctly using the EditorFor of MVC 2, it us setting the name of the form field differently depending on context, which causes some headache when posting to a different URL. Here is what happens: I have a model for a login form: public class LoginForm { public string Email { get; set; } pub...

RedirectToAction isn't working correctly

I have a simple MVC2 app that doesn't seem to Redirect correctly. The code is setup as follows: [HttpPost] [Authorize] public ActionResult QuickAddEvent(CalendarEvent calEvent) { if (ModelState.IsValid) { int eventID = repo.AddEvent(calEvent); return RedirectToAction("Event", new {...

ASP.NET MVC: files containing extension methods inside App_Code must have Build Action "None"?

This seems to be the only thing that works: If a .cs file is inside App_Code... And does not contain extension methods: set the build action to "Compile"; otherwise no other source code in the project knows of its existence. And contains extension methods: set the build action to "None"; otherwise you get an error that the reference t...

User is not available in this context - error generated after upgrading ASP.Net MVC app to .Net 4.0

I'm trying to move an ASP.Net MVC app from 3.5 to 4.0 but running into issues. The upgrade went smoothly enough and the application runs on the Cassini server but when run on IIS7 the following error is thrown: [HttpException (0x80004005): User is not available in this context.] System.Web.HttpApplication.get_User() +4640350 Syste...

What would be the best tool for me to use for this project idea?

I'm going to make a website where users (including myself) can create programming tutorials with full pictures to guide anyone who needs help for free. Common tasks, like configuring the Web.Config, creating a database connection in C#/Java/Python etc. I'm planning on using ASP.Net MVC2. Thanks for the help. ...

asp.net mvc2 Hw do I use Actionlink to jump from root straight to details page

On a root page in my project I have a number of different country services gathered by category all on one page. The Category is the "Index" page in the View folder in a separate area, and the particular service is the "Details" view. I want the user to be able to jump straight past the category in the (in this case China) area to that p...

ASP.NET MVC 2 and ComponentModel.DataAnnotations Validation: minimum value attribute

I'm decorated a ViewModel in my ASP.NET MVC 2 site with System.ComponentModel.DataAnnotations validation attributes. For one of my fields, named Price, I want to validate that the value is not below some extent, in this case 0. I know that RangeAttribute exists for validation with a lower and an upper extent, but does something like a M...

ASPNETDB.MDF for ASP.NET MVC on Production server

Hi guys, I am getting this error when I copied my application to application folder (I published the web application to my local IIS, then I copied to production server, this happend on production server): The database 'C:\INETPUB\WWWROOT\TEST\APP_DATA\ASPNETDB.MDF' cannot be opened because it is version 655. This server supports ve...

ASP.NET MVC2, How to Add Metadata Attributes and Control the order of properties displayed in the View

In ASP.NET MVC2, I have two ViewModels with Parent-Child relationship as below. Parent ViewModel: public class PersonViewModel { [Required] public int ID{get;set;} [Required] [StringLength(50)] public string Name{get;set;} } Child ViewModel: public class EmployeeViewModel:PersonViewModel { [Required] [StringLength(50)] publ...

ASP.NET MVC2: how to set paths for the image links continaing with in the CSS file

I our application we have image patches set in CSS file as shown below .HeaderShodow { background:url('../../App_Images/HeaderShodow.gif') repeat-x top left; height:5px; } when we move this application to iss6 server the images or not rendered we have sent css/image/script links with in the aspx file as below <link href="<%...

Ajax.BeginForm in ASP.MVC2

I'd like to capture submit action from "Ajax.BeginForm (...)" and asynchronously fetch some data from controler and put it into some div... How can i do it? I've tried Ajax.BeginForm(..., new AjaxOption( UpdateTriggerId = "", ) but as i noticed it is used for online checking form or something like this... How can i disable reload wh...

MVC Testing using a mocking framwork (Moq)

Hi I'm using Moq to help in testing my ASP.NET MVC2 application. Problem: ArgumentException was unhandled by user code. Unable to obtain public key for StrongNameKeyPair This code has been adapted from Scott Hanselman's NerdDinner1. HomeController CreateHomeControllerAs(string userName) { var mock = new Mock<Controller...

Django forms analog in ASP.NET MVС

Hi guys, Is there any analog to Django forms (http://docs.djangoproject.com/en/dev/topics/forms/?from=olddocs) in ASP.NET MVC 2? ...

what ADO.Net version is currenlty used in ASP.net MVC 2?

Hi, Current ASP.Net MVC 2 uses Linq to SQL or Linq to entites? i am using VS 2008. Cheers ...

Where is the 'ViewLocator' or 'WebformViewLocator' in ASP.NET MVC 2

I'm looking at some (old) sample projects of ASP.NET MVC 2, to do some self-teaching on the subject. However, I 'WebformViewLocator' no longer seems to be present in MVC2, while it is used in the sample projects... Searching for breaking changes on WebFormViewLocator does not make me any smarter... Has it been removed/replaced/renamed...