asp.net-mvc

Model Binding to a List in asp.net mvc 2. Found example. Can't find where I'm going wrong.

I've based my work on Phil Haack's article here: http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx I've also looked over several posts here on StackOverflow and I can't seem to derive an answer for my problem from them, though, they probably present a solution. I guess I need the bits broken down a bit more. I'm attemp...

given a url, can I get which route mapped? similiar to how mvc does it internally?

I want a function that, given a URL, returns me the route that matches. This is exactly what MVC does under the covers, how do they do it? I have the source, but not sure where to look. ...

Routing error using MVC on iis 5.1

I am using .NET MVC 2 with Windows XP (IIS 5.1). I have set up wildcards per this blog. The problem I run into is sometimes when I call some of my actions, they are returning 404 errors. Here's how I'm calling them (using a button): <% using (Html.BeginForm("MyController", "MyAction")){ %> <input type="submit" value...

How do you modify the URL in ASP.NET MVC when a form is submitted?

I am working on a web page that offers a form with a dropdown list to view data from a different year. The year is part of the URL routing that is configured. When the page loads, the URL can be something like: activitylog/department/year. When the form is submitted on this page, the URL does not change, even though the user has sel...

Convert Classic ASP and ASP.NET Webforms to ASP.NET MVC

I currently work for a company that uses a combination of ASP.NET Webforms and legacy ASP pages for web development. This works fairly well for their current projects but I would like to convince / suggest to them to switch over to ASP.NET MVC since most of their codebase consists of wiring form elements to stored procedure parameters. J...

repeat common error info logic in ActionFilterAttribute

I'm implementing a web API using the REST for ASP.NET MVC framework (MVC 2). I want to encapsulate this code, ideally in an ActionFilterAttribute (?), so that I can decorate specific actions that always perform this same logic: if (!ModelState.IsValid) { return View( new GenericResultModel(){ HasError=True, ErrorMessage="Model is ...

ASP.NET MVC (MVC2) Best practices when Inserting/Updating Data using Linq to SQL and Repository layers

I'm in a bit of a conundrum here and I'm hoping for some of you Guru's to help fill in the blanks. The situation I'm currently facing is with regards to my "Users" table and my "OpenID" table. My app allows for a user to have multiple OpenID's, so I keep track of them in a separate table. Users ID Username OpenID ID Us...

ASP.NET MVC2: Can't find controller

I have an MVC 2.0 web site that is using Areas. When I go to the default page (localhost/mywebsite/default.aspx), it correctly routes to the correct action in the correct controller and renders the default view correctly. But on the page I have several Html.ActionLinks, and these do not seem to be able to find the Controller. When I c...

Custom VisualStudio toolbox items for rendering MVC partials/arbitrary text

Our development team has a number of semi-technical users that act as intermediaries between our developers and domain experts. One of their tasks is building forms using a very clumsy, antiquated system that makes their job much harder than it should be. I'd quite like to create toolbox controls similar to the standard HTML controls th...

ASP.NET MVC User Control - Where to put the CSS specific to a control?

I am getting ready to code a bunch of ASP.NET MVC User Controls. All those controls are UI and require CSS. What are the best practices for that? Should I have one gigantic CSS file with the code of all controls? Ideally, I would like each control to have their own CSS file. Is it possible to do that? Thanks! ...

User Controls and strongly typed data

I am trying to pass a strongly typed object to a UserControl, but I am not able. I must be missing something. So my User Control expects an object of type Data which contains a list of string. On my page, I call RenderPartial with the name of my user control and the data. However, when the page run, it says in that this.Model (or this.Vi...

Get controller name in View T4 template

I have a problem similar to the one described here: http://stackoverflow.com/questions/1128003/mvc-t4-mvctexttemplatehost-and-customized-controller-t4-template but hopefully, simpler. I have a custom View templates (View.tt, Create.tt) for ASP.NET MVC project. I can't figure out how to get the controller name in these view templates. mv...

Development on ASP.NET MVC Storefront Project

I see that there is no Check-Ins on ASP.NET MVC Storefront code since Feb 7th. Can anyone please make me aware about whats going on. And on this question, Orchard project link is given with the answer. Is there any relation between these two projects? ...

DataAnnotations over WCF

I'm sending a DTO over wire (WCF) which has on one property the DisplayName atribute from System.ComponentModel and on a other one the ScaffoldColumn attribute. On the client I have a ASP.NET MVC 2 app and I use the Html.EditorFor(x=>x.DTO) extension method.When the page is rendered it looks like the attributes wasn't there. The DTO [S...

ASP.Net MVC, Ninject IOC.

I'm using Ninject to do some dependancy injection. (Mainly for the DAL), my project consists of 3 aspects and are as follows, Project.Lib (Everything database, services and anythign else that is logic) Project.Admin (Administration) Project.Web (Front end what the user see's) Now, each of my controllers within my projects inherit fro...

Issue with RouteValueDictionary and RedirectToRouteResult

I have created the following RedirectToRouteResult: new RedirectToRouteResult(new RouteValueDictionary{ { "controller", "Login" }, { "action", "Failed" }, { "ReturnUrl", filterContext.HttpContext.Request.Url.PathAndQuery } }); This fails to find the specified ...

sending mail using asp.net mvc

How send mail using Asp.net mvc? Any example for this? ...

Routing with multiple parameters

Hi I am trying to add additional parameter in my route routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "CustomRoute", "{controller}.mvc/{action}/{id}/{recid}", new { action = "Index", id = "", recid = UrlParameter.Optional } ); ...

Html.TextArea maxlength problem in asp.net mvc

Im using Html.TextArea in my application and when i set its maxlength property to 255. It doesnt work and write more than 255 characters. how can this problem be solved ...

Create hyperlinks in MVC Action Method

I have an action method returning a JsonResult in my controller: public JsonResult GetDetails() { var rows = //Linq-To-SQL //Linq-To-Entities var lifts = (from r in rows group r by new { r.LiftID, r.LiftDate } into g select new { ...