asp.net-mvc

Multiple rows have multiple submit buttons, should I make a form for each button?

I am listing about 20 rows, each row represents an Order. Each row needs to have 3 buttons, each button click will perform a different action. I have 3 actions to handle each button post request, I am just unsure how to setup the Html forms for each button. <tr> <td> <form method="post" action="/orders/do1"><input type=button ... /></...

Why can't I publish MVC project

I'm having problems publishing my MVC project. When I do publish and upload everything to web server I get this: [InvalidOperationException: The view 'Index' or its master could not be found. The following locations were searched: ~/Views/Home/Index.aspx ~/Views/Home/Index.ascx ~/Views/Shared/Index.aspx ~/Views/Shared/Index.ascx] Weir...

How to do you add an Entity Framework object data source to an RDLC report in VS 2010?

I am trying to lay out an RDLC report for an ASP.NET application. I am using the entity framework and have a partial class that returns a list of entities generated from the EDMX designer. All files are namespaced correctly and in the same project to simplify the problem. I am trying to work through the sample here: http://msdn.micros...

MVC Unable to save data

My application is modelled after NerdDinner presented in http://www.asp.net/mvc/learn/. I am having problem saving my posted edit and create pages even none of the business rules in the following Helper class is violated. The only place that I can think of is the database table foreign keys are violated. Could someone help me to catch...

How do I use a custom constraint with a HttpMethodConstraint in ASP.NET MVC routing?

I have a controller that only accepts a POST on this URL: POST http://server/stores/123/products The POST should be of content-type application/json, so this is what I have in my routing table: routes.MapRoute(null, "stores/{storeId}/products", new { controller = "Store", action = "Save" }, ...

Modeling relational tables into a single object - ASP.NET and Entity Framework 4

I am writing a blog using ASP.NET MVC2 and using EF4 as the ORM. I want to use Tags for navigation instead of traditional categories. Tables: Post Table - Id - Title - Body - Slug - PostDate PostTags Table - PostId - TagId Tags Table - Id - TagName I want to be able to get a Post object that includes a list of associated Tags. I am ...

Spitting out HTML with asp.net mvc

Hi everyone, Here is a way that we are currently spitting out some HTML to our view. foreach (var reportGroup in managedReportGroup.CustomerTags) { %> <%= reportGroup.Name %> <% } Is there something that I can do like this? (This won't work for me) Action<...

C#: bitwise operator in enum (Custom Authorization in MVC)

I'm currently reading an article , but I do not really understand how this work with the logical operator. Can anyone explain this to me? eg. If I want to have 4 level securities with customer, employee, supervisor and Admin. [Serializable] [Flags] public enum WebRoles { customer= 1 << 0, employee= 1 << 1, sup...

How to get Html helper code

After many attemps to get Html.ActionLink<> and Html.Image() methods from different assemblies without any success could you help find the source of these methods so that I can use them in my Web app ? Thanks ...

Does a ViewModel have its own logic ?

When assigning ViewModel fields, should the domain objects be passed directly to the ViewModel objects which will then determine how to present the data, or should another class like a service be assigning data from the Model to the ViewModel? also: EDIT:is there any sense in dividing a viewmodel into receiver and presenter? (instead ...

mvccontrib test helper and verifying http post routes and parameters

In my Asp.net MVC app, I have two methods on a controller, one for when the user first arrives on the view and then one when they submit the form on said view. public ActionResult Foo() {} [AcceptVerbs(HttpVerbs.Post)] public ActionResult Foo(string id, Account accountToFoo) {} In the second action, there's a custom model binder that...

PartialView Dynamic BeginForm Parameters

If I have the below PartialView <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Models.Photo>" %> <% using (Html.BeginForm("MyAction", "MyController", FormMethod.Post, new { enctype = "multipart/form-data" })) { %> <%= Html.EditorFor( c => c.Caption ) %> <div class="editField"> <label for="file" c...

Problem in displaying the selected value from dropdown in mozilla(C#).

I am using a list of SelectListItem in C# to populate the items of a dropdown. When I select another option, IE8 just updates the same displaying the selected value, but in Mozilla, the selected value is not displayed. I am using MVC 2.0. The whole page is reloaded with the selected option of the changed one. I am confirming by seeing th...

How to maintain user's session in ASP.NET MVC application?

Hi I am working on migrating the existing ASP.NET application to MVC. Earlier we used to maintain the user sessions and can be accessed in whatever page we want. Ex: Session["UserType"] = var_UserMastersBO.UserType.ToString(); We set this session Global.asax file. In case if there are restricted pages based on the userType, we check...

Using ViewModel Pattern with MVC 2 Strongly Typed HTML Helpers

I am working with ASP.NET MVC2 RC and can't figure out how to get the HTML helper, TextBoxfor to work with a ViewModel pattern. When used on an edit page the data is not saved when UpdateModel() is called in the controller. I have taken the following code examples from the NerdDinner application. Edit.aspx <%@ Language="C#" Inherits=...

is asp.net mvc 2 RC is ready for production

Is there any risk associated by using asp.net mvc 2 on production or stick to the asp.net mvc 1. ...

Hosting MVC2 on IIS6

Hi I need a little help. I'm trying to host an MVC 2 application on IIS6. On my dev machine (XP) it runs perfectly in Cassini or as web site in IIS. First i tried to reference the .mvc extension to aspnet_isapi but when that didn't work i went with the aspx extension instead. Any ideas? I've probably missed something obvious. public ...

Mapping action input variables to an array via a route, with constraints

Hi there, I am trying to map a number of querystring variables into an array that is one of the parameters for an action method. The action method is as follows: public ActionResult Index(string url, string[] generics) { //controller logic here } We can easily get MVC to bind to the variable generics by using a querystring such as...

fluent nhibernate Exception error

am trying to implement fluent nhibernate in MVC project...there were no build errors... but when i run the project i get this exception System.Xml.Schema.XmlSchemaValidationException: The element 'class' in namespace 'urn:nhibernate-mapping-2.2' has incomplete content. List of possible elements expected: 'meta, subselect, cache, synchro...

How to enumerate Areas in ASP.NET MVC 2 RC

My controller has to enumerate all the areas in the application. Is it possible? And how? ...