asp.net-mvc

asp mvc 2 structure map not working when deployed.

I'm using structure map in my asp mvc site, which i've just tried to deploy onto II6 for the first time. The basic dependency structure is very typical: public ControlMController(IControlMService controlMservice) { this._controlMservice = controlMservice; } ... public ControlMService(IControlMRepository re...

Moving from WebForms to ASP.NET MVC

Hello, i know ASP.NET and i would like to learn and make a new project in ASP.NET MVC. Is it easy to move from asp.net to asp.net mvc? Will the knowledge i have so far be helpful? Im asking because i will have only few days to learn asp.net mvc and i want to know whether it's possible... Cheers ...

Is it possible to group a LINQ set into a dictionary with one query?

Given a table of order items (OrderItems) that relates to a table of orders (Orders), which in turn relates to a table of users (Users), is it possible to retrieve all the OrderItems and group them into a dictionary by OrderId with just one query? ie. without performing an iteration over either the OrderItems result set or performing a q...

asp.net mvc is it proper to create an instance of a controller in another controller's constructor?

Hi, i have several controllers which will all be using common functionality. So i have separated that functionality into a separate controller. the shared controller needs a parameter specific to which controller it is being used from, and needs to return views based on id ints passed to it. So, one idea is to create an instance of S...

asp.net mvc storing username / other ID information after forms authentication for communicating with stateless wcf services

hi, I have reviewed some of the similar questions on this site but could not find one with an answer appropriate for my situation. I am using asp.net mvc, and it is communicating securely with stateless wcf services. for each service call, i need to pass in the username and a few other ints for identification purposes. - not password...

ASP.NET MVC 2 - How to POST form Model from PartialView?

I have a single model type to wrap up various models I want to use in my view: public class QuestionViewData { public Question Question { get; set; } public IList<Answer> Answers { get; set; } } Now, in my question view I pull the data from the Question object - that's fine. Secondly I iterate through all Answer object...

ASP.Net MVC multiple inheritance in a View

Hello, I'm trying to figure out if its possible to have multiple inheritance in a view in ASP.Net MVC. Right now I'm trying to print out a list of entries from two different tables from my model in a single View. I have the following line at the top of my view: Inherits="System.Web.Mvc.ViewPage<List<GEApproval.Models.CoursePrefix>>" ...

New Error in Strongly-Typed View - Cannot Enumerate Model?

I am currently using ASP.NET MVC 2.0 RC2, having recently moved from version 1.0. I have noticed that some of my views no longer work. I have views that inherit from a strongly-typed IEnumerable, like this: Inherits="System.Web.Mvc.ViewPage<IEnumerable<MyProject.Models.MyType>>" In the past, I have enumerated the model in my view li...

What would be considered straight asp.net? (not mvc and not webforms)

I know the difference between ASP.NET webforms and ASP.NET MVC and I've seen quite a few videos explaining that they both run on top of ASP.NET (and I've used both). However, my question is, how would one develop right on top of ASP.NET without webforms or mvc.net? Would this be the equivalent of having a project with only .ASHX files?...

How to create a fake repository with a 1-to-many association for MVC

I'm trying to create a fake repository for unit testing with a class object that has a one to many relationship. I'm using ASP.NET MVC and Linq to SQL. My reference is Steven Sanderson's "Pro ASP.NET MVC Framework" book. I've created the Entity Classes with the association: [Table(Name = "Albums")] public class Album { [Column(Is...

LINQ DataContext Concurrency Between 2 Applications

Hi guys, I have a database that is accessed by two applications. The first is an ASP.NET MVC application which just reads data out of the database. The second is a C# Console application which reads and writes to the database. The problem I'm experiencing is that when the console application performs a mass update of up to several hund...

How to add a row with Html.TextBox() on a table using jquery.

I have added the Html element to the table with table row but,i am getting problem with adding the Html.TextBox() to the table with a table row using j Query when a button is clicked. ...

How do you get model metadata from inside a ValidationAttribute?

MVC2 comes with a nice sample of a validation attribute called "PropertiesMustMatchAttribute" that will compare two fields to see if they match. Use of that attribute looks like this: [PropertiesMustMatch("NewPassword", "ConfirmPassword", ErrorMessage = "The new password and confirmation password do not match.")] public class ChangePass...

Getting data out of a model made of multiple tables in a one-to-many relationship

Hi, I've got a relatively simple question about asp.net MVC models. I've got a model based on two tables that are linked in a one-to-many relationship. table AnimalGroup(ID,name) table AnimalSubGroup(ID,name,AnimalGroupID) Each AnimalGroup has any number of AnimalSubgroups. How do I iterate through each AnimalGroup's AnimalSubGroup...

How to validate Form in MVC 2 using Entity Framework

I am using MVC 2 and following the example here: Using Data Annotation Validators with the Entity Framework When I click the Create button in my Create View nothing happens. The ModelState.IsValid is true always. What could be wrong? Product.cs using System.ComponentModel; using System.ComponentModel.DataAnnotations; namespace MyProj...

When/Where should i create the following class in my ASP.NET MVC project?

Hi folks, I have a simple class that contains some general information about the current web site :- public class WebSiteSettings { public EnvironmentType Environment { get; set } // Eg. Production public VersionType Version { get; set; } // Eg. Version2 public string ApiKey { get; set; } // Eg. ABCDE-1234 } Now, I wish t...

Going from VS 2010 Beta 2 to VS 2010 RC in MVC 2 projects causes 'The project type is not supported by this installation.'

I just installed VS 2010 RC and now my MVC 2 project created in VS 2010 Beta 2 won't load stating: 'The project type is not supported by this installation.' Sweet! What the hell do I do now? Anyone else having this issue? ...

Does ASP.NET MVC have any DateTime route constraints?

Hi folks, does ASP.NET MVC contain any route contraints baked into the code? if so, how do i define a date-time constraint? eg. url: http://mydomain.com/{versionDate}/{controller}/{action} http://mydomain.com/2010-01-20/search/posts cheers :) ...

httphandler doesn't engage for non-home pages

I have an MVC2 application, and HttpHandler Library. The library, to simplify, serves an image. The problem is that if I invoke this handler from the root page ( http://whatever/ ), everything works fine. If, however, I change the Global.asax, so the same page now has the address of http://whatever/controller/action - it doesn't work (AL...

mvc formatting text

i have text like this div bla-bla end div i need to get only 'bla-bla' without div, because of i need to call substring in controller only to text bla-bla not to div tags. is it possible p.s. how to input tags here? ...