asp.net-mvc

How do I maintain ModelState errors when using RedirectToAction?

I have some code that saves a ticket in our system. If there is an error it does a RedirectToAction. The problem is that I don't seem to have my errors in the new action. How can I fix this? ModelState.AddModelError("_FORM", "Unable to save ticket"); ModelState.AddModelError("_FORM", "Phone number was invalid."); ModelState.AddM...

Editable "GridView" like control in ASP.NET MVC

I'm trying to build a Editable GridView like control (Order column) with this code in the view: <table> <tr> <th> Name </th> <th> Order </th> <th> <img alt="Save order" src="<%= Url.Content("~/Content/minisave.png") %>" /> </th> <th></th> ...

Asp.Net MVC...Glorified Property Bag?

Asp Mvc feels like a glorified property bag from the examples I've seen on www.asp.net. My perception of MVC is that the controller can delegate actions that need to be completed by the view and manage the general flow of the system. I'm I perceiving MVC incorrectly? Where can I find better examples of how to use asp.Net MVC? Edit: ...

Passing data from JQuery to Controller Action

Do I have to do anything special to my controller action method to accept/bind data from a .ajax() call? Controller Action - public class TestController : Controller { public JsonResult GetTestJsonData(Metadata data) { return new JsonResult { Data = data }; } } JQuery Call - <script type="text/javascript"> $(...

Where do Subsonic classes go in an ASP.NET MVC Project?

I've built ASP.NET webform projects in the past, and when generating Subsonic classes, the teams I have been on have put our Business Layer/DAL objects into a Project.Framework project. Would that still be a recommended structure, or should the Subsonic classes go directly into the /Model folder within the MVC web project? ...

routing to blank request in mvc asp.net using IIS 6.0

I'm attempting to connect to my published website using the following url. http://www.mywebsite.com/ I keep getting: The incoming request does not match any route. Here are my routing rules: routes.MapRoute( "Default", // Route name "{controller}.aspx/{action}/...

ASP.Net MVC Routing and the PreRequestHandler

I'm trying to instantiate a service and authenticate the current user within the Application_PreRequestHandlerExecute() method and then dispose of this service in the* Application_PostRequestHandlerExecute() method of the global.asax.cs class. One of the items I need for this process is the orgname which is appended at the beginning of ...

ASP.Net MVC Json Result: Parameters passed to controller method issue

I'm having a problem getting a controller method that returns a JsonResult to accept parameters passed via the JQuery getJSON method. The code I’m working on works fine when the second parameter ("data") of the getJSON method call is null. But when I attempt to pass in a value there, it seems as if the controller method never even gets ...

ASP.NET MVC - Is there a way to return 2 PartialViews?

Hi everyone! Is it possible to return 2 PartialViews in my ActionResult instead of one? Thanks!! ...

Where do you store validation logic?

I'm playing around with the MVC.Validation Toolkit. The goal is to use the same validation rules in client script and in the server code. However i keep making new poco classes for everything. I have one class from linq2entities, then I got one class that is passed from the datalayer to the business layer, then to the controller. And I ...

Can I make ASP.NET MVC Html.RouteLink() return a url for my home page without an ID?

I've got a single route in my Global.asax.vb page like this... Shared Sub RegisterRoutes(ByVal routes As RouteCollection) routes.IgnoreRoute("{resource}.axd/{*pathInfo}") routes.MapRoute( _ "IdOnly", _ "{id}", _ New With {.controller = "Page", _ .action = "Details", _ ...

DropDownList with Firefox and ASP.NET MVC

I have been hitting a brick wall on this for about an hour now. I have a list of counties that I build and add to my view data (counties) and then render the list with a: html.DropDownList('invoice.county', counties) in my view. It appears to render correctly but FF REFUSES to set the selected item. I have tried swapping the values ...

asp.net mvc localization

I'm trying to implement localization with routes I have the following: routes.MapRoute( "DefaultLocalized", "{lang}/{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = "", lang = "en" } ); r...

ASP.NET MVC vs Webforms

I have a very simple question about MVC. What is it really and why should I notice it. I know it is not replacement for asp.net but What is it in ASP.NET that I cannot do and hence require MVC . I know google.com is the best way to find some answers but I thought if someone over here who knows this really well can explain me, I would ...

I want to use ASP.Net MVC. My server is Win 2003 and it uses IIS 6, will all this work together?

ASP.Net MVC is finally available as version 1. I have been waiting for an official release before I try to start using it. At the moment I have a dedicated web server which I have complete access to via remote desktop. It is running Win 2003 Server with IIS6 (I think it is IIS6, they don't print the version in the Help -> About but a bit...

How can I get data from dynamic generated controls in ASP .NET MVC?

I want to generate a couple of checkboxes on an ASP .NET MVC page. How can I retrieve their data in a controller after posting the page? ...

ASP.NET MVC Client Validation with jQuery using Html.ValidationMessage?

I am trying to tap into the HTML.ValidationMessage() element to write so really custom client side validation with jQuery. Is this even possible? My server side validation is displayed using the HTML.ValidationMessage(), and I am wondering how I would access that element to display a custom message using jQuery before a form submit. I...

Validation Message

I have a problem with setting validation message. i have two Model in one control and both Model have same property "amount". So setting validation for one Model.amount will reflect to other Model.amount as well. I have tried to pass different ids to both but not working. <%= Html.TextBox("amount", Model.amount, new { id = "Pamount" }...

Need simple example of how to populate javascript array from Viewdata list

Hi - There may be a simpler way of doing this and I am all ears if there is. My situation is I have a dropdownlist on a form which I successfully populate with text and values. I also need to have additional related string values from the same table row in the db table available on the client so when the user selects from the dropdown t...

ASP.NET MVC model binding foreign key relationship

Is it possible to bind a foreign key relationship on my model to a form input? Say I have a one-to-many relationship between Car and Manufacturer. I want to have a form for updating Car that includes a select input for setting Manufacturer. I was hoping to be able to do this using the built-in model binding, but I'm starting to think I'...