asp.net-mvc-2

ASP.NET MVC Membership DB must be merged with site DB?

I am planning to use ASP.NET MVC2 implemented membership system to manage users. Database that uses application should have tables that are related with these users. Is it possible to use two different databases and make relationships (foreign keys) between them or I will have to merge these two databases into one? Thanks, Ile ...

ModelState dictionary

hi, I have a ViewModel class and I would like to change one of its propetry via ajax calling. In the controller I setted the property to the new value but the data wasn't refreshed on the UI. I debugged in the MVC framework and I found the following part of code in the input extension class: default: string attempt...

Cannot Create a Asp.net MVC 2 project in Visual Studio 2008

I Installed Microsoft's Asp.net MVC 2 using the Web PI (on Windows XP) but it is never marked as installed! i have found the "system.Web.Mvc.dll" in "C:\Program Files\Microsoft ASP.NET\ASP.NET MVC 2\Assemblies" so i'm pretty sure it's indeed installed but i cannot create a new Asp.net MVC project in Visual Studio 2008 because the option...

Trying to update an ASP.Net MVC 1.0 project to MVC 2.0

I'm trying to update my project to ASP.Net MVC 2.0 from MVC 1.0. I've removed the references for System.Web.MVC to the newer versions. I'm getting an exception from the HTTPContext which reads "CurrentNotification = 'HttpContext.Current.CurrentNotification' threw an exception of type 'System.PlatformNotSupportedException'". What other...

ASP.NET MVC 2.0 Unused Model Property being called when posting a product to the server?

i have my auto-generated linq to sql classes, and i extend this class using partial classing (instead of using inheritance), and i have properties that that i've put in later which are not part of the database model and should not be. these are things like "FinalPrice" and "DisplayFinalPrice" - in the dbase, there is only RetailPrice and...

Passing values with the UIHint to the View

With the UIHint you can also store some data on the model so you can react with that in the View. The Sintax as described in some blogs is: [UIHint("TemplateToUse",null,"Variable1", "Value1", "Variable2", "Value2", ...)] public string Something { get; set; } And then I try to access this on the View with ViewData.ModelMetaData.Aditi...

How would you validate a checkbox in ASP.Net MVC 2?

Using MVC2, I have a simple ViewModel that contains a bool field that is rendered on the view as a checkbox. I would like to validate that the user checked the box. The [Required] attribute on my ViewModel doesn't seem to do the trick. I believe this is because the unchecked checkbox form field is not actually transmitted back during ...

using AsyncFileUpload in ASP.NET MVC 2

Is there a way to use AsyncFileUpload in ASP.NET MVC 2. Or maybe there is an equivalent (that uses no browser plugins)? ...

Button Onclick event (which is in codbehind) doesn't get triggered in MVC 2

I had an MVC 1.0 web application that was in VS 2008; I just upgraded the project to VS 2010 which automatically upgraded MVC to 2.0. I have a bunch of viewpages have codebehind files that were manually added. The project worked fine before the upgrade, but now the onclick even't don't get triggered. I.e. I have an asp:button with an ...

Logging a user session for playback

Running an MVC2 site against IIS7 and would like to capture more detail of how users traverse the site - ideally to the point of being able to replay even the duration between mouse clicks - feedback of where people pause and/or backtrack. I could do this with flash but that's no longer an option. Now it's just IIS7 via asp.net f4. IIS...

ASP.NET MVC 2 relative paths for scripts and styles

Hi, having this really silly problem in ASP.NET MVC 2 with .NET 4. I need to test other pages using localhost, but sometimes I need to show the page to some else on another computer and so need to path out to my machine. In doing so, I need to use relative paths for my and tags. When I test through VS, I use relative path: <script sr...

Modern way to handle and validate POST-data in MVC 2

There are a lot of articles devoted to working with data in MVC, and nothing about MVC 2. So my question is: what is the proper way to handle POST-query and validate it. Assume we have 2 actions. Both of them operates over the same entity, but each action has its own separated set of object properties that should be bound in automatic ...

ASP.NET MVC2 Custom membership

Is there any tutorial of how to create custom membership for asp.net mvc2 based on asp.net membership provider? Thanks in advance, Ile ...

Membership - get user email

I am using ASP.Net MVC2 with the default membership/profile/role providers, I'd like to access the user email in my ForgotPassword Action to email a new password to the user, but so far I've only been able to get the username (User.Identity.Name). Am I missing something here? ...

A realistic and usable (VS2010) MVC2 project template?

Hello. everybody. The default MVC2 web project template which VS2010 creates when you select "ASP.NET MVC2 Web Application" is quite a nice start... but nowhere near a realistic app framework. E.G.: user accounts without such features as password recover easily customizabile (and maybe multilingual) error messages an interface to man...

Passing ViewData to PartialView returned from using Html.Action

I want to embed a partial view in an ASP.NET MVC page by returning it from an action method. In my base view, I would have: <%= Html.Action("MyPartialViewAction") %> My controller would have an action method like: [ChildActionOnly] public ActionResult MyPartialViewAction() { return PartialView("MyPartialView"); } I expected th...

MVC 2 Validation and Entity framework

I have searched like a fool but does not get much smarter for it.. In my project I use Entity Framework 4 and own PoCo classes and I want to use DataAnnotations for validation. No problem there, is how much any time on the Internet about how I do it. However, I feel that it´s best to have my validation in ViewModels instead and not let ...

ASP.Net MVC 2 is it possible to get the same instance of model(with slight changes) in HttpPost method, that was passed in HttpGet

Hi I have a complex entity User: public class User : BaseEntity { public virtual Taxi Taxi { get; set; } --> That is why i call it "complex" public virtual string Login { get; set; } public virtual string Password { get; set; } } where Taxi is a parent of User (Taxi has-many Users): ...

delay with serving asp.net mvc application - precompile?

I am using discount asp to host an asp.net mvc 2.0 application. Unfortunately, every time I go to a page on the site, there is a long delay of 10-15 seconds. I am assuming that this is because the apppool is getting unloaded due to inactivity and once a request is received, the app has to reload which takes some time. How do I avoid this...

where to store temporary data in MVC 2.0 project

Hello! I'm starting to learn MVC 2.0 and I'm trying to create a site with a quiz: user is asked a question and given several options of answer. If he chooses the right answer he gets some points, if he doesn't, he looses them. I tried to do this the following way public class HomeController : Controller { private ITaskGe...