asp.net-mvc-2

Weird ASP.NET MVC Home route behavior

Wondering if anyone has come across the following: I have an ASP.NET MVC (v2) site. If I hit /Home/Index, the home page is served correctly. If I hit /Home/, the home page is served correctly. If I hit /Home, the home page is served correctly UNLESS I'm using Internet Explorer, in which case I get a File Download dialog box wanting me ...

Does asp.net 4.0 webforms have url and form databinding?

I am not sure what this is called. If know know what it's called you can edit this post. asp.net mvc allows you to do this: public ActionResult Index(FormCollection fc) { Item.Add(fc); return View(); } It is nice that in MVC the FormCollection object is automatically populated with the relevant data. Is there anything like ...

[Flags] Enum with mvc rendering in checkbox on my view, reaction of my controller ?

If i got a list of checkbox in a View, and this list came from Enum (flags). If my checkbox as all the same name, did my controller will update automaticly my Enum (flags) values in my ViewModel with multiple selection ? Suppose i get in my View <% foreach (var t in Enum.GetValues(typeof(FoodType))) { Respons...

.NET Presentation Tier Architecture / Blueprint for Line of Business Systems

We are revisiting our presentation tier architecture as a blueprint for future new, and re-written business systems (Just the presentation tier), using Microsoft technology stacks. We have around 30 .NET systems (2, 3 and 3.5), about 60% of which are web based (CWAB + Web Forms) and 40% Smart Client (using CAB / SCSF, WinForms) All syst...

Div as Ajax.ActionLink

Is it possible to create Ajax.ActionLink which has instead of text, the whole DIV? I'd like to map div on Ajax.ActionLink Thx in advance ...

"Add" option missing commands in MVC 2 RC project in Visual Studio 2010

I am working on this project which was created using ASP.NET MVC 2 RC. The "Add" has disappeared when I right click on the files. My problem is similar to this: http://stackoverflow.com/questions/2136074/vs-2010-beta-2-asp-net-mvc2-project-cannot-add-areas but the WalkThrough answer didn't help. example: "Add" option is there for "Cont...

How do i get a Request Object outside a controller in asp.net mvc2

Is there a way to get the Request Object in a Html Helper Method. I'd like to know if a file exists to replace non existent Files with a default Image. Therefore i need the Request Object and it's Method MapPath(path). Has anybody an idea. Thx Thomas ...

can't modelbind on controller constructor in mvc2

I am modelbinding my session object. If i add the object in my action signature like so the object is bound and works correctly public ActionResult Index(UserSession userSession) { Response.Write(userSession.CompanyImagePath); // this works // other logic etc.. return View("Index", viewModel); } However i'd rather bind this on...

Return one record from my Model based on two parameters sent to my repository asp.net mvc 2

I pass two parameters to my repository to return one record I am strugling to wite the code to return one record. Here is my repository- public Classifieds_Ads GetUserClassifiedDetailsToModify(int classifiedid, Guid UserGuid) { return context.Classifieds_Ads.Where(c => c.User.Id == UserGuid && c => c.CatID == cla...

Mixing VB6 "legacy code" and a web application

I'm working on a new website, written in VB.Net using ASP.NET MVC2, there is a need to call "legacy" VB6 code for various complex bits of business logic. The VB6 is a framework consisting of many dlls and is very stateful, we are pretty much emulating how the framework is used in our client application, ie the application runs (lots of ...

ASP.NET MVC 2 routing on IIS 7 - can only view homepage on previously working website, what can I try to fix it?

Am pulling my hair out over this! I have an ASP.NET MVC 2 web application, which up until yesterday was working fine on the hosted server (running IIS 7.5, I don't have direct access to IIS, just web portal access to some features). Yesterday I attempted to install the ELMAH logging framework (see this article) and now all my routes ap...

Best way to dependable View's - possible patterns?

I'm trying to create something simmilar to Builder and Factory patterns but operating on Views in ASP.MVC 2 Why this problem appears? I've some model, which has many dependencies, which in turn affect on many parts of whole view of this input model. What do I need? Flexible way to build output view, from many parts which should depend ...

How to disable input field's autocomplete with EditorFor?

<%= Html.EditorFor(product => product.Name) %> I need the generated output to have autocomplete="off" attribute set. What I'm missing? Edit: I'm looking an extension method for EditorFor that accepts key/value dictionary for attributes, so I can call it like this: <%= Html.EditorFor(product => product.Name, new { autocomplete = "off"...

ASP.Net MVC - Send Javascript Associative array to a controller

I'm trying to pass a javascript associative array to a controller. I can pass normal arrays into a controller with this: public JsonResult ProductsByFacets(List<string> facets) but this won't work with associative arrays ...

query string problem

Hi, I have switched from asp.net mvc 1.0 to 2.0 My actionlinks: <%=Html.ActionLink("Add bla", "addbla", new { id = Model.Id })%> now produce urls like this: addbla/500 rather than: addbla/?Id=5008 does this have to do with the routing: routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.IgnoreRoute("{*favicon}...

How do I include static html in an asp.net mvc app that doesn't use the system css, but it's own styling?

I am using ASP.NET MVC 2 & C#. I want to include/embed an html page (raw text & styling; no forms) in one of my views as is without my own css styling (read: The site.css styles for the ASP.NET MVC 2 application itself) affecting it. I can access the page statically and open it in a new window and it retains it's styling; however, if I ...

Passing a dictionary to a view Asp.net MVC

I'm pulling data from MongoDB in C# Asp.net MVC2. Here is the code I'm using in the controller. var mongo = new Mongo(); mongo.Connect(); var db = mongo.GetDatabase("DDL"); var Provinces = db.GetCollection("Provinces"); var documents = Provinces.FindAll().Documents; ViewData["Document"] = documents; return View(); Now I'm unsure ho...

MVC Getting Managment approval

I have just started looking into .net MVC and I really like it. There are a few developers within our team who think the same. But before we are alowed to use it for any project we need to get the approval of management. What would be the best way to convince management(which know little about programming) that this would worth while an...

Sharing data between Actions and application behavior

Hi, This is my application's current workflow for user registration. register form ( GET /register ) submit the form ( POST /register ) after success, redirect route to "/registerSuccess" in (GET /registerSuccess ) view, I want to show the message like "username has been registered successfully". Controller Actions: public Action...

How to customize the "The value 'foo' is not valid for Number." error message?

[MetadataType(typeof(PersonMetaData))] public partial class Person { public class PersonMetaData { [Required(ErrorMessage="The number is required")] public object Number {get;set;} } } This error message is shown when the number field is empty and when there's an invalid input it gives "The value 'foo' is not va...