asp.net-mvc

Membership provider properties not being read from web.config

I'm having a problem with a custom Membership implementation for ASP.NET using EF. The thing is, my web.config features the default values for the provider but at runtime those default are only being read in Initialize() the first time provider is instantiated (that happens for instance when I request the Register view via GET but when I...

MVC RedirectToAction not rendering updated html in View

Here's an overview; I have a view with a table of data and upon changing the filter options (checkboxes) I call a filter action, do some work, then redirecttoAction to the main action which accepts my filter info. Stepping through in debug I can see the expected data passed through the actions and even on the View with the building of t...

How can I pass the URL to the controller while routing ignores it?

Hi There, Is there a way within asp.net MVC 2 whereby I can route a request and have a portion of the URL ignored and passed to the controller as a variable? My needs state that I must store pages dynamically in a database, and they should be accessible by looking at the URL and reading the URL segments to find the relevant page. Effec...

Applying Required Attribute Valiation on a Collection, IEnumberable

Hi, how can I apply Required Attribute like validation to the following without knowing how many elements will be in each collection: public class MyViewPageViewModel { [Required] public List<int> IntCollection { get; set; } [Required] public Dictionary<int, string> IntAndStringAllValueCollection { get; set; } [Required("Val...

ASP.NET MVC 3 and HTML Helper Extensions

I am trying to work out whether I am misunderstanding something about ASP.NET MVC or whether I have found some sort of bug in ASP.NET MVC Beta 3. I am having a problem with a PartialView picking up the wrong model when using HTML Helper extensions My controller code looks like this: public ActionResult EditGeneral(MapGeneralViewModel v...

Different response to non-authenticated users and AJAX calls

My ASP MVC (1.0) website has a default login page (based on OpenId - but that shouldn't make a different). It works fine when AuthorizedAttribute is on the Action/Controller. However, I have AJAX requests coming in as well. Here is what I do with them: if (Request.IsAjaxRequest()) { if (Request.IsAuthenticated) { // Authentica...

ASP.NET MVC - Catch All Route And Default Route

In trying to get my application to produce 404 errors correctly, I have implemented a catch all route at the end of my route table, as shown below: routes.MapRoute( "NotFound", _ "{*url}", _ New With {.controller = "Error", .action = "PageNotFound"} _ ) However, to get this working, I had to r...

ASP.NET MVC images and other static content url

I just edited my route for a user details page to look like this: routes.MapRoute( "UserDetails", // Route name "{controller}/{action}/{id}/{title}", // URL with parameters new { controller = "Users", action = "Details", id = UrlParameter.Optional, title = UrlParameter.Optional } // Parameter ...

How do you validate multi-part models?

I'm working on a really big order form with a bunch of multi-part data that's submitted all at once. I'm using that trick where you render 30-40 item rows in the HTML and allow the user to "show" or "hide" more or less using jQuery. The problem is that while the user may have, say, three rows "showing" and they happen to fill all three ...

Problems binding data to dropdownlist in MVC

Hi guys, Learning MVC and having major trouble over the last two days trying to bind data from a database to a dropdownlist in MVC. I'm currently following the nerddinner tutorial. I have followed it exactly and somehow still ended up with this error. The ViewData item that has the key 'Dinner.Country' is of type 'System.Strin...

How to generate ASP.NET MVC slugs from multiple fields?

My url should look like this: localhost/Products/Details/1/asus-intel-core-2-duo. As you can see, the slug is generated from existing fields: brand-processorBrand-ProcessorModel. My title will also look like this, without the dashes. I generate this slug in my Service layer. I have 2 questions: Where and how should I store this format...

executionTimeout not work on asp.net mvc

I tried set the executionTimeout in web.config for an asp.net mvc application. <location path="Home/Index"> <system.web> <httpRuntime executionTimeout="5"/> </system.web> </location> any used the Thread.sleep in Index action public ActionResult Index() { Thread.Sleep(30000); ...

What is ASP.NET MVC about ?- is it just about URL's?

MVC frameworks in general? Is it different from MVC in desktop GUI applications? What exactly is it that makes it easier to test than WebForms ? (Can't you test Code Behind in a similar way to MVC controllers) I have the impression that ASP.NET MVC is mostly about clean URL's - with controllers processing user input in the form of URLs....

Pass a function to LINQ query.

I'd like to pass a function to LINQ queries to do operations on existing data. For eg. I have this function: string doStuff(Product prod) { return string.Format("{0} - {1}", prod.f1, prod.s2); } When requesting products, i'd like to pass in this function so it returns this string and assign it to a product property NewString. An...

MVC Logon just refreshes page - doesn't log on

Hi I have 2 MVC sites on a shared hosting environment. The first one works fine and I can log on and use the membership provider etc.. no problems. A second site can see the database and retrieve other (site specific) data on its pages. However when I try to log in I simply get a page refresh - no error messages with invalid UC/PW, and n...

Using Webmatrix helpers in regular ASP.NET MVC project

Hi, The Webmatrix Html helpers look quite handy. Is there any way to use them from a regular ASP.NET MVC project with Visual Studio? Thanks, Adrian ...

Asp.net MVC 2 JqueryGrid table row empty

I need some help with asp.net mvc Controller: <HandleError()> _ Public Class HomeController Inherits System.Web.Mvc.Controller Function Index() As ActionResult ViewData("Message") = "Welcome to ASP.NET MVC!" Return View() End Function Public Function GetMovieData() As ActionResult Dim sortColu...

Modify the Template Helpers MasterPage with Razor

I am using the new Razor view engine with ASP.NET MVC and would like to know how to modify the editor template master page in a similar way to how it is done in this blog post. Is there any examples on how to do this with Razor? ...

How to choose between different test types with SpecFlow, Cucumber or other BDD acceptance test framework?

I am looking at SpecFlow examples, and it's MVC sample contains several alternatives for testing: Acceptance tests based on validating results generated by controllers; Integration tests using MvcIntegrationTestFramework; Automated acceptance tests using Selenium; Manual acceptance tests when tester is prompted to manually validate re...

Silverlight as an editor in an ASP.NET MVC site

I'm considering the scenario where an MVC view would pass the model to a Silverlight application (to display preferably as a modal form), which in turn would send back the updated model to the view before submitting. Is this at all possible? ...