asp.net-mvc

MVC pattern + DDD pattern

In an MVC application, how is DDD implemented. What are the domain objects? If I map entities to custom objects, where does this mapping logic go, in the methods of the repositories or in the service layer? ...

ASP.NET MVC Html.DropDownList SelectedValue

I have tried this is RC1 and then upgraded to RC2 which did not resolve the issue. // in my controller ViewData["UserId"] = new SelectList( users, "UserId", "DisplayName", selectedUserId.Value); // this has a value result: the SelectedValue property is set on the object // in my view <%=Html.DropDownList("UserId", ...

Grouping View File along with Controller File

In WinForm and WebForm Application, Visual studio groups the 'View' File and 'Contorller' File, together. I found very easy to manage file in that way. Now in ASP.Net Mvc , i'm finding difficult to manage views, separately in completely different folder. Is there any way to group View and Controller files in VS Solution Explorer, like...

How to access anonymous type returned by controller in view?

In MVC RC2 I am returning an anonymous object type & I want to access it in a strongly typed view. Let's say that in the controller I query the database & fetch values in var type & I want to pass it to a strongly typed view. How can i access it in that view? ...

Pitfalls of deviating from the {controller}/{action}/{id} REST URL format for ASP.NET MVC?

I will be launching a new site soon. One section of the site contains products. I am currently trying to decide between different URLS for the ASP.NET routing : **Products: ** /products/1001 /products/sku/1001 /products/product/1001 /products/view/1001 **Categories: ** /products/category/cats /products/category/clothing /pr...

Application helper in ASP.NET MVC

I am searching for a way to make an application helper that allows you to define methods that you can call in all the controllers views. In Rails you get that for free but how can I accomplish this in ASP.NET MVC with c#? ...

strongly-typed partial views MVC RC1

having a problem passing ViewData.Model to the partial views. It always is defaulting to null even if I equate it to a result query. I cannot access the strongly typed data because the Model is null. My current code is this, ViewPage <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <% Html.RenderPartia...

ASP.net MVC RC2 - Checkboxes with explicit values

Is there a simple way to use the existing Html Helpers to generate a list of checkboxes with explicit values (as was possible in Beta)? Example in Beta (possibly with MVC Contrib): .CheckBox("Field", 6, new { value = 6}) would output: <input id="Field1" type="checkbox" value="6" name="Field" /> <input id="Field2" type="hidden" value="...

ASP.Net MVC - dropdown list for associated objects

I have two models in my application: Product and ProductType. Product has a reference to ProductType (in the DB it's named ProductTypeId), while ProductType has two columns (Id and Name). I can get the dropdown to be properly populated and displayed on the forum using the following code: Controller: var typeList = new SelectList(_en...

Good ASP.NET MVC pattern for form submit and immediate result display

I hear everyone recommends redirecting the user (HTTP GET) after he submits the form (HTTP POST). It's clean, there is no "do you want to resend" alert, it's simple... But, what if I want to show some result to the user? Okay, I can add some parameter to the GET url, like "/?message=1" and then check for that parameter.orm But, what ...

Root route breaking paths

I'm in the process of deploying an ASP.NET MVC app to IIS 6, but am running into an issue with the root path. In Global.asax, I have the root path mapped: routes.MapRoute("Root", "", new { controller = "Dashboard", action = "Index", id = "" }); When I navigate to http://servername:70/test2/, the app displays the right page, but ...

ASP.NET MVC - Getting QueryString values

Under ASP.NET MVC are you supposed to pick up QueryString params the same way you do in ASP.NET WebForms? or does the [AcceptVerbs(HttpVerbs.Get)] declaration get used somehow? ...

How to make ASP.NET MVC work in IIS 6?

I have installed .NET Framework 3.5 SP1 and ASP.NET MVC CTP in a Windows Server 2003 R2 box, but my ASP.NET MVC site still doesn't work on that server. I was searching the internet and IIS for a solution and I noted that I can't choose other .NET Framework version besides 2.0 for my virtual directories. I'm almost sure if I correct this ...

asp.net mvc uploaded image size

How can I check the size of an image a user is uploading? Client side first with server side double check would be the best solution. ...

Extending/replacing Html.Image for Amazon S3 (or other CDN)

Just want to confirm that there is no way to extend or replace Html.Image functionality without writing a replacement function. I want to write a function that will use Amazon's S3 service for hosting images. The best approach I've come up with is a helper method Html.SmartImage which would check a configuration property to see if i wa...

ASP.NET Automated deployment to remote ftp server

Does anyone know any good solutions for automated deployment to a remote server using SFTP? I am specifically trying to deploy an asp.net mvc website to mosso. I can do it manually every time using an SFTP client, but would much rather have an automated (and consistent) way to do this. ...

MVC FormsCollection

In .Net Terminology, 'FormCollection' means 'Collection' of 'Forms' 'System.Windows.Forms.FormCollection' is collection of System.Windows.Forms.Form In ASP.Net MVC, 'FormCollection' is little confusing. Is it Collection of all Submit 'Forms' in webpage ? (Or) Is it Collection of Input controls on paritcular form ? ...

passing arguments to Action methods in ASP.NET MVC

Can anyone advise me how to write an action method that handles data from a form with the following input elements? <input type="checkbox" name="check[1]" /> <input type="checkbox" name="check[3]" /> The numbers in square brackets are not array indexes but can be IDs e.g. Also, I do not know how many such input fields the form i...

Puzzling ... why do most of my links, in ASP.NET MVC, have Length=4 appended to them?

Why does the following code: <%= Html.ActionLink("[Click Here For More +]", "Work", "Home", new { @class = "more" }) %> render as: <a class="more" href="/Home/Work?Length=4">[Click Here For More +]</a> Where is that "Length=4" coming from? Update If I remove the new { @class = "more" }, I don't get that Length=4 parameter. ...

ASP.NET MVC - switching the VIew to be used dynamically

What is the correct way to dynamically change the View (the view aspx) that a controller method uses versus using the standard naming convention. I'm guessing it has something to do with the ViewResult and ViewName, but what is the correct syntax? Update: One thing I forgot... is there a way to do this without having the "action" or me...