asp.net-mvc-2

ASP.NET MVC 2 View Model DDL lists: Where to store the choices, hard code in a view or store in a database?

We currently have a "Lookup" table which contains a set of possible choices for things like a drop down list. If this were a list of state abbreviations, LookupID would represent the set, and LookupItemID would represent the individual state. customerID int PK lookupID int PK lookupItemID int PK lookupValue string ...

Problem with JSON Response from ASP.NET MVC in Some Browsers

I'm using jQuery's form plugin (as suggested in a number of threads like this one) to make an Ajax post to a .NET MVC controller and consume the JSON I get back. It works just fine in Chrome, but in some other browsers, including Firefox 3, the form submit results in a "Save or Open this file" dialog box. The JavaScript looks like: var ...

Question on Structure

Hi, I have an ASP.NET MVC 2 project. I've decoupled layers. I have a service layer and a repository layer. The controller calls service methods and only the service layer calls methods in the repository. The problem is: A method in my repository class uses LINQ joins. From this method, I would like to return a type with merging some da...

How to create and return an Expression<Func ...

I Use entity Framework 4. I would like to be able to create a function that return an Expression func that will be use in a lambda expression. var ViewModel = _db.Suppliers.Select(model => new { model,SupType = model.SupplierType.SupplierTypeTexts.Where( st => st.LangID == 1) }); I would like to mak...

CS0234 for Referenced Local Project

I am receiving the CS0234: The type or namespace name '...' does not exist in the namespace '...' (are you missing an assembly reference?) I notice when I click on "Show Detailed Compiler Output" that the project nor its binary output is referenced in the csc build command. It was working fine before but after I make a few changes in...

application role management in asp.net mvc (How) ?

Hi, I have developed the asp.net mvc + C# application. it has 2 users as Super admin, Admin and User. I want to manage the functionality as per their roles. I am managing the data in sql server database .How to manage this in asp.net mvc ? where shuold i have to write the code for this management ? ...

How do I prevent the `Index` action appearing in my ASP.NET MVC2 urls?

I have a route that looks like this (but I've tried a few different ones): routes.MapRoute( "Metrics", "Metrics/{action}/{id}/{resource}/{period}", new { controller = "Metrics" } ); On the MetricsController I have the following actions: // Index sets up our UI public ActionResult Index(int id, string resource, string period) /...

Validating multiple textboxes using JqueryValidation in MVC

Iam rendering partial a view twice on the same parent view.Since each child view has 1 textbox each I have 2 textboxes. Iam trying to use JqueryValidation Plugin as in $("#form0").validate({ rules: { Address<%=Model.TypeName%>: { required: true, minLength: 8 } }, messages: { Address...

ASP.NET MVC2 Route Mapping ignore action and id

I'm trying to add a FAQ section to a website that I'm working on and I want to ignore any action or id that is added to the URL. The RegisterRoutes method of the Global.asax.cs file has been changed to; public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( ...

Pass the id via getJson of the item selected in a select

I have a select: <%: Html.DropDownListFor(c => c.DataTextField, Model, "Please select", new { id="selected-contract"}) %> and on change I am calling an action via $.getJSON: $("#selected-contract").change(function () { $.getJSON("/Contract/List", [WHAT GOES HERE] ,updateList); }); The bit I am struggling with is pass...

Return HTML code via JSON

Using an .net MVC2 app is generating a string of HTML code that be copy/pasted by my users to a 3rd party's web app. In other words, i'm not looking to render the HTML - i want the string to be displayed verbatim. I need to understand what JSON/jQuery properties have to be explicitly set so that my app's string shows up as pure ascii -...

ASP.NET-MVC: Do Database Default Values Break The Spirit of Unit Testing?

Related Question My Question: In the key of ASP.NET-MVC - Do Database Default Values Break The Spirit of Unit Testing? ...

Uploadify won't work with my asp.net MVC 2 application.

Hello all, When I use uploadify to upload photos to the server I use the following script (The script is placed in the Photo.aspx (this is the view of the UploadController and the Photo action)): <script type="text/javascript"> $(document).ready(function () { $("#fileInput").uploadify({ uploader: "../../Ima...

MvcContrib Grid - Go to first page when sorting

Hello , i am using the MvcContrib grid for an mvc application. I have set up sorting and paging , but I have to make the grid to go the first page when the user sorts the grid . Any ideas on how doing that ? ...

Use XSP4 in MonoDevelop

Hey folks, I´m currently trying to get a MVC 2 (.NET 4.0) application running on Mono, but I´ve got some problems with the XSP server. Everything is fine, when I press the "Run" button in MonoDevelop. My application starts using the correct version of ASP.NET: Mono Runtime Version: 2.8 (tarball Tue Oct 5 14:16:19 MDT 2010); ASP.NET Ver...

How to make ASP.NET MVC View Insecure via location tag in Web.Config

I have the following authorization settings in my web.config: <authorization> <deny users="?" /> </authorization> This deny's all anonymous access to the application accept the login page. In addition to this I am using authorization within each controller action via a custom authorize attribute. I have one additional action ...

Namespace error when using T4MVC

Just heard about T4MVC but i can't get it to work in my sample project (ASP.NET MVC 2, Visual Studio 2008). I get the following erros when trying to build the project: Error 1 The type or namespace name 'Account' does not exist in the namespace 'Northwind.Web.MVC' (are you missing an assembly reference?) C:\Users\Bruno\Documents\My ...

Image Pathing and Absolute Paths?

I'm developing a website in ASP .NET MVC 2 using C#. I have a partial view, Header.ascx. In there I have an image for my website, MainImage.png. When I use one of the primary Views I've created, the image shows up fine. For instance, I hit the Index ActionResult of my News Controller. (site.com/News) However, when I dig deeper, I se...

MVC2 Partial view not rendering properly

Hi There, May be I am getting the whole idea wrong but this is what I am facing as a horrible problem at this point. In my application (MVC2, ASP.NET) I have something like following : <%using (Html.BeginForm("ProcessOrder", "ShoppingCart", FormMethod.Post, new { @name="processorder"})) { %> other html codes. [typically a cart item lis...

What is jquery-1.4.1-min-vsdoc file for?

Hi I am trying to publish my asp.net mvc application. it is build successfully, but not publishing. also whatever the contents found in the publishing target folder is not running jquery files properly. it showing Warning : Warning 1 Error updating JScript IntelliSense: D:.. My application path.. \Scripts\ *jquery-1.4.1.min-vsdoc.js : ...