asp.net-mvc-2

ASP.NET MVC2 Posting a ViewModel mapping to Domain (LINQ) to Submitting changes

I'm using AutoMapper to map between a Linq Domain object and a ViewModel to display an Edit Form to the user which works perfectly. When they click submit I'd like to know the best way to map the ViewModel back to a Linq entity and persist it to the database. The Linq entity I'm using has multiple collections of other entities (ie one-...

asp.net MVC Portal/CMS - Controller and widget design?

I'm currently working on a portal using jquery portlets/sortable/draggable that also includes a content management system, all in MVC2. Only administrators are able to change the layout/content of the site currently. Each view gets the personalization for a page (from the base controller) based on Controller and Action. Then the view lo...

.net mvc2 - change view location from controller

I have 2 urls /Data and /Data/{month}/{day}/{year}. I've created two routes routes.MapRoute( "Data_Name", "Data", new { controller = "Data", action = "DataForAnyDate" } ); routes.MapRoute( "DataFullDate", "Data/{mon...

Problem switching culture

i have 2 links for switching culture. if i click one link, the program call a method with this code: Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo(ln); Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(ln); return RedirectToAction("index"); If i look with debug the culture i...

Passing multiple checkbox values to action with Jquery

I have a bit of a problem that's been driving me batty. I have a page which generates a list of checkboxes based on a search. Also within the page is a dialog box designed to show up when a button is pressed. What I'm trying to do is get values from the checkboxes and pass them to a controller action which then returns the partial for t...

passing values between views in mvc?

Hi I new on MVC. I want to send values between view's and don't know how do this? also I want send selected-item in grid to another view. ...

ASP.NET MVC 2 Data Validation: Make C# Regex work for both C# and JavaScript simultaneously?

I have this C# regex: ^\s?((?<qty>\d+)\s?/)?\s?[$]?\s?(?<price>\d{0,2}(?:\.\d{1,2})?)\s?$ and use MVC's data validation at the client. JavaScript says this regex is invalid, although C# works perfectly fine. Any idea how to get it to work for both C# and JavaScript, since it doesn't seem possible to provide a separate JavaScript Reg...

Spark View Engine with custom HTML Helpers

I've added some of my own helpers to the System.Web.Mvc within my project and got it working with the default asp.net mvc view engine. By defining the helper like namespace System.Web.Mvc { public static class XSSHelper { public static string h(this HtmlHelper helper, string input) { return AntiXss.H...

DropDownList MVC C#

Hello all, I want to create a dropdownlist, but am struggling with how I display it. I have the following code. Controller var trader = new DisplayTradersAttachedToCategoryViewModel { Description = data.Description, Id = data.Id, BusinessName = traders.Select(x =...

Show missing PartialView as a build error

Hey everyone, I've been reorganising our views at work and moving them around to more appropriate locations. Because we're currently organising many of our views into their own folders within the Views folder, we're having to reference our views using the full path in RenderView. Is there a way that I can get Visual Studio to throw a ...

How to associate each user visiting a web app with a separate, temporary process allocated by a service?

Hi all, I want to develop a web application using ASP.NET running on IIS. If a user submits a MAXIMA input command, the code behind will ask a custom windows service to create a new distinct temporary process executing an external assembly. More precisely, there is only one windows service serving for all users, but each user will be...

How do I get my Objects to work in ASP.NET MVC2

I'm rather new to MVC2 (never been in MCV1) though I'm a WebForms developer for some years now... in my MCV 2 start project I created a App_Code folder that I would put my Business Classes on it, I also add 2 References to 2 DLLs used for the API I'm about to use. But I don't get Intellisense on the referenced objects What am I doing ...

Prevent Image Caching in MVC 2 C#

I have a profile image upload page, where users can overwrite their previous profile picture. But when I return the users to their profile page the browser has cached their previous image and only an F5 refresh returns the new image. Is it possible to prevent the browser from caching the image, as some users might think their new uploa...

Filtering a graph of entity framework objects

I'm trying to filter down the results returned by EF into only those relevant - in the example below to those in a year (formattedYear) and an ordertype (filtOrder) I have a simple set of objects PEOPLE 1-M ORDERS 1-M ORDERLINES with these relationships already defined in the Model.edmx in SQL I would do something like... select *...

Where and how to load dropdownlists used in masterpage

Hi! I'm new to MVC! I am trying to use two DropDownLists (Cities, Categories) in a PartialView that will be used in MasterPage, meaning they will be visble all the time. I tried to load them in HomeCOntroller, but that didn't work. I got an Exception. I read something about making a baseController that the other controllers will inh...

How would I configure the global.config to allow for root path to actionMethod in MVC2?

specifically, the default directory naming structure is [Controller]/[ActionMethod] resulting in a rendered url like www.mysite.com/home/actionMethodName. What if I want to simply imply the Controller (in this example, 'home') so that I can get a url that looks like this: www.mysite.com/actionMethodName. I haven't seen many requests fo...

Where to set the ModelMetadataprovider with DI when using MVC Turbine ?

To use your own ModelMetadataProvider you normally set it in the global.asax. I'm using MVC Turbine and I need to inject a dependency into my ModelMetadataProvider as well. Something like this: ModelMetadataProviders.Current = new MyModelMetadataProvider(ISomeDependency); How is this best accomplished with MVC Turbine? ...

Creating an edit form using ASP.Net MVC 2 scaffolding.

I have the following code that was generated using scaffolding and IDJefe is an int in my database, but I want the end users to choose a name from a comboBox. How could I accomplish this? <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<SeguimientoDocente.Area>" %> <asp:Cont...

ASP.NET MVC - Filter which action to invoke based on the query string

Hi, i was wondering if it was possible to filter which action is invoked based on a paramater in the query string. For example, i have a grid with a radio button column to select an item in the grid. The grid is wrapped in a form and at the top of the grid are buttons to edit/delete the selected item. Clicking on the edit/delete butto...

Does JQuery AJAX have a different User Session than a postback to the same website?

Does JQuery AJAX have a different User Session than a postback to the same website? I am trying to send data to a MVC2 Controller through a Jquery Ajax POST with a querystring on it and then this MVC2 Controller will take the data from querystring and place it into the User's Session. Successfully while debugging I see that the Control...