asp.net-mvc

Bind Exclude Asp.net MVC doesn't work on LINQ Entity

I'm currenty manage to get some time to work on ASP.NET MVC. I'm doing the tutorial Create a Movie Database in ASP.NET MVC, which still uses the ADO.NET Enity Model. I managed to create a List View from the LINQ Entity Model. So here is my problem. The Bind Attribute doesn't work on my SQL Entity. Original Code with Ado.NET pub...

Append row to <TABLE> using Ajax.BeginForm()

I have an HTML <TABLE> displaying a list of items in the rows of the table. To add a new item to the list of items I have a form which submits the data to my controller via AJAX using Ajax.BeginForm. Once the action on the controller has finished it returns a partial view containing the markup for a new row to append to my table (eg. <...

ASP.NET MVC: how to signal compilation error if a view has error?

My view has errors. I see these errors only if I open the view in Visual Studio. I would like to see the errors on compile time rather than on execute time. Does exist a way to obtain this behavior? ...

Why doesn't this inherited view render?

I tried the following: I have a shared library (.dll) that contains these files: Views Search PowerSearch.aspx PowerSearch.aspx.cs PowerSearch.aspx.designer.cs The PowerSearch.aspx file contains my html code. The PowerSearch.aspx.cs file contains this: using System.Web.Mvc; using CommonProject.Web.Shared.Controllers; namespace...

Change views root folder

Is there a way to change the root folder for the views to the bin/views folder? ...

ASP.NET Redirecting in a Base Controller

I have created a base controller which overrides Initialize and sets a cookie and saves some data in the DB. Here I also need to check if a cookie is set and if it is not redirect to an error page. Users of this site are coming from a store locater on another site which passes the store ID to me and I set it in a cookie. I need to make...

NHibernate: need to update object ID with @@identity after insert

I'm using NHibernate for the first time and struggling. On web page one, I start a form. I want to save and navigate to page two. How do I update my RequestForm object with the ID of the newly inserted row? It is still 0 when I call the redirect, though the data was persisted to the DB. Here's my controller code: [AcceptVerbs(HttpV...

How to unit test a controller that calls Url.Action using AutoMockContainer?

This question is very similar to 674458 but I really want to use the AutoMockContainer in my unit tests. I cannot figure out how to setup up my context. Has anyone been able to unit test a controller that calls Url.Action using the AutoMockContainer? ...

Passing Html Element to the Controller

Hi, How can I pass a HTML element to a controller action. Let's say I have the following element: <table id="list"></table> How do I pass this table into the controller action? Also will it be automatically converted to HtmlTable object? ...

Roles available with Windows Authentication

I'm trying to add Roles authentication to an Action in a Controller in an ASP.NET MVC application. The code looks something like this: [Authorize(Roles = "SomeRoleName")] public ActionResult Index() { bool inRole = User.IsInRole("Admin"); If I remove the Authorize attribute and put a breakpoint on the last line in that code sample...

Strongly-Typed ASP.NET MVC with ADO.NET Entity Framework

I've finally gotten this working after days of struggle. I've got a simple database of People and Departments: I can use strongly-typed ASP.NET MVC views for reference/navigation properties! See the list of departments... Part of my Person/Edit view: <% using (Html.BeginForm()) {%> <%= Html.Hidden("Id", Model.Id) %> <fie...

How to add User.Identity to session (or something) using MVC

I'm working through a previous webforms application to convert it to MVC and have one big issue that I can't seem to find any good resources about. I want the ability to capture the identity of the user (windows auth set in the web.config) but in the global.asax I can't seem to get access to session (but I can get the identity informati...

Using WCF REST Starter Kit with ASP.NET MVC

I recently converted an ASP.NET Website to an ASP.NET MVC Application and no longer appear to have access to the WCF REST Starter Kit templates when attempting to Add > New Item... Is it possible to use the two together or is the starter kit only available within a website? ...

Inject a MembershipProvider into ASP.Net MVC AccountController

Asp.Net MVC 1.0 project templates include an AccountController class, which supports constructor injection: public AccountController(IFormsAuthentication formsAuth, IMembershipService service) { FormsAuth = formsAuth ?? new FormsAuthenticationService(); MembershipService = service ?? new AccountMembershipService(); } An A...

ASP.NET MVC resolve urls in javascript

I am loading up some content via jQuery.load('/Business/Tags'), which works well when using my local webserver. But when using iis this does not resolve correctly. I have seen a couple different ways to get around this such as ResolveUrl. What is the best way to handle resolving urls in your javascript? ...

Handling lookup tables in Entity Framework

I am just getting started with Microsoft's Entity Framework, using it for an MVC project since MS seems to be really pushing it, and I'm running into some issues. In my database there are multiple lookup tables tied to a single table via foreign keys. Within the entity framework I am trying to combine these into one so that I have a simp...

How should I set-up my solution when using ASP.net MVC ??

When using ASP.net webforms my usual solution would have following type of setup - MyCompany.MyProject.Presentation.MyWebFormsApp (asp.net web forms ) MyCompany.MyProject.Service.MyServieLayer (WCF/Web Service) MyCompany.MyProject.Business.MyBusinessLogicLayer (class project) MyCompany.MyProject.DataAccess.MyDALayer (class project/Linq...

Which gets instantiated first in ASP.NET MVC, Action Filters or Controllers?

Do the MVC Action Filter Attributes run, before the controller is instantiated? I have a property of the controller, that I would like to check from the ActionFilter. Is this possible? ...

How to fake Foreign Key Collections Properties in Entity Framework and ASP.NET MVC

In Alex James' blog post How to fake Foreign Key Properties in .NET 3.5 SP1, he explains how to add a Foreign Key property to an Entity Object. I've used that to get a reference/navigation property working with a DropDownList in a strongly-typed ASP.NET MVC application as explained here: Strongly-Typed ASP.NET MVC with ADO.NET Entity F...

Thickbox asp.net mvc

Hello guys, I've found awesome using thickbox with asp.net mvc ....but now i need to use it with ajax and then....it displays only a blank page. It is not loading the page inside of it. This happens only on the ajax call...that i'm doing like this <%= Ajax.ActionLink("GetFuncao", "GetFuncao?height=155&width=300&inlineId=hiddenModalCon...