asp.net-mvc-2

Way to change the default doctype to XHTML strict for newly-created ASP.NET MVC views?

Besides copy/paste on each newly-added View, that is... And can anyone think of any reasons not to use Strict doctype with ASP.NET MVC 2? ...

ASP.NET MVC 2.0 - data in ViewModel lost after post

Hi there, I have a Controller called ProductController. The Controller code is below: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using Services.Abstract; using Web.Models; using Ninject; using Services.Entities; namespace Web.Controllers { public class ProductControl...

Multiple route values

I'm working on a project that requires me to sort a column of a list and the list is several pages long. Currently, when I sort, everything sorts correctly, and when I go to the next page, it does just that. My problem is that once I sort and go to the next page, I lose my sort value. I'm using the ActionLink Html helper method to gen...

Clean way to pass data to Master Page from View in ASP.NET MVC2 (set css class from view)

I have a ASP.NET MVC2 application with a master page. The master page renders the site layout divs as follows: <div id="wrapper"> <div id="column1"> {contentplaceholder} </div> <div id="column2"> {contentplaceholder} </div> </div> In my View, I would like to apply a classname to the wrapper div, so when viewing the ...

Very weird behavior with Linq to SQL and MVC

I have an Action that requires authentication. The action method creates some records with foreign keys using Linq to SQL. When the user calls the action and is logged in the method works without a problem. When the user is not logged in, MVC redirects them to the login page with the returnUrl parameter. After a successful login the acti...

Better Way to Build jQuery Tabs

I am utilizing jQuery UI Tabs in an ASP.NET MVC 2 web application. One part of the application requires that I do error checking when I switch away from the tab. I am doing that via this script within the aspx file that contains the tabs. <script type="text/javascript"> $(function () { $("#tabs").tabs({ cache: t...

What are the requirements to host an ASP.Net MVC2 application?

Are there any special requirements needed to host an ASP.Net MVC2 application? I'm making an application that will be hosted locally in the server area of my University. I can use either ASP.Net or MVC2, but I'd much rather use MVC2. ...

Sharp Architecture, Nhibernate and MVC

I Would like to start a small project using MVC, NHibernate and maybe the sharp architecture to get familiar with the techs. With no experience with all above, should I include sharp architecture along with MVC & NHibernate? If yes, any good site / tutorial for the beginner learning sharp architecture along with MVC & NHibernate? Appreci...

Visual Studio 2008 RTM and Visual Studio 2010 RTM MVC2 exist side-by-side?

I have Visual Studio 2010 Ultimate version 10.0.30319.1 RTMRel and Visual Studio Team System 2008 Database Edition version 9.0.30729.1 SP, both on the same machine, which is running Windows 7. I need to edit an MVC2-based solution using VS 2008. (I realize MVC2 is built into VS 2010.) If I install AspNetMVC2_VS2008.exe (MVC2 for VS 20...

How to add Custom logic for validation using asp.net mvc data annotations?

I have read this before about asp.net mvc validations but does not mention what i want to do,So have this view model - public class MyViewModel { [StringLength(200, MinimumLength = 2, ErrorMessage = "Invalid Name")] public string Name { get; set; } [Required(ErrorMessage = "*")] public DateTime StartDate...

Relative path to a web application project in asp.net 4.0 ?

Hi all I have a project that i reference the services for my graphs...and i have hardcoded urls something like - ViewData["weeklyGraphURL"] = "\"http://localhost:9713/MyProject/MyAction"+Id + "\""; So this url is basically another projects controller action...and i have both these projects in one solution...is there a way i could set ...

ASP.Net MVC & Comet (WebSync)

I'm trying to implement comet in my ASP.Net MVC 2.0 project. I'm using WebSync from FrozenMountain. My website is coded in C# 4.0 and ASP.Net 4.0. The comet code is triggering my MVC controller function with the [HttpPost] attribute (even though the page doesn't refresh or appear to post). Is there a way to determine what is being post...

IIS7 URL rewrite + subdomain + ASP.Net MVC2

So I am working on a project with multiple areas and we would like to configure IIS to rewrite our requests to make the urls nicer. I have been messing around with the URL rewrite module all day and I cannot get the desired results. Example: I currently have a long url like 'http://register.example.com/Registration/Register/New' where...

TryUpdateModel doesn't work

I am following though the examples in Professional ASP.Net MVC 2 and one of the examples doesn't work for me. [HttpPost] public ActionResult Edit (int id, FormCollection collection) { Dinner dinner = dinnerRepository.GetDinner(id); if (TryUpdateModel(dinner)) { dinnerRepository.Save(); return RedirectToActio...

Are strongly typed ASP.NET MVC views smelly for composite models

Consider 2 options for a real-world application that needs to build a model, a composite model if you will, from a variety of sources the choices for for using strongly typed views: Create a new custom class for the model with a property for each piece of information that needs to be passed to the view stage, Confine the models to the ...

Manipulating page scrolling when returning a View in an ASP.NET MVC site

I'm building an ASP.NET MVC site where I want one of the Views I return to be automatically scroll to a certain point. The part of the site where I want this to occur works sort of like a forum - there are "threads" that contain "posts". A user can either browse to the whole paginated thread or can browse to a specific post, using its I...

ASP.NET MVC 2 Model partial binding

Hi, My problem is that I want to partially edit my model - to display 2 fields and to edit another 2 fields for example. When POST happens, returned model contains only the fields that are editable, other fields that I use only to display are NULL. How to fix this, on POST to be returned model with all fields, because on ERROR when I ret...

validation with Ajax.BeginForm, asp.net mvc2

Hello Everyone, i m working on a meeting manager and on configure meeting page i call three renderActions to populate the page. <fieldset> <span style="float:right;margin-right:20px;color:Red;"><%=TempData["error"] %></span> <%Html.RenderAction("MeetingInfo", new { meetingid = Request["meetingid"] }); %><br /> ...

switch from asp.net mvc 1.0 -> 2.0

Hi, I am currently trying to move from asp.net mvc 1.0 to 2.0 in an existing solution (s#arp framework). Most things seem to work fine apart from unexplainable error messages: Compiler Error Message: CS0828: Cannot assign method group to anonymous type property Source Error: Line 10: <p> Line 11: [ Line 12...

ASP.NET MVC-2 How can you recieve a POST from another website?

If another website is making a POST to my ASP.NET MVC 2 site, how can I capture it? Do I need to do anything to the routes? eg The other site does this: string url = "https://mvc2-site.com/TestReceive"; // that's my site's controller action NameValueCollection inputs = new NameValueCollection(); inputs.Add("SessionId", "11111"); Sys...