asp.net-mvc

ASP.NET MVC model binding an IList<> parameter

[I solved this myself, see my answer for cause] I'm having trouble getting form values for a IList<> argument in a controller method set properly. My controller class looks like this: public class ShoppingBasketController : Controller { public ActionResult Index() { return View(); } [AcceptVerbs(HttpVerbs.Post)] ...

ASP.NET MVC productivity?

Though, i'm still a novice for ASP.NET MVC, my manager asked me for a report about ASP.NET MVC's productivity. Actually we are planning to develop a real life, kinda big system using ASP.NET MVC. The questions are: 1- Is it really goona scale for a fairly large system? 2- Is it goona be easy for developers to pick up in a short period ...

Elegantly reducing the number of dependencies in ASP.NET MVC controllers

We are developing what is becoming a sizable ASP.NET MVC project and a code smell is starting to raise its head. Every controller has 5 or more dependencies, some of these dependencies are only used for 1 of the action methods on the controller but obviously are created for every instance of the controller. I'm struggling to think of a...

Passing a boolean value in my .net MVC view to a javascript, but JS doesn't accept True, wants true

Hi, I am passing a boolean value to a javascript function in my .net mvc action page. problem is, it is outputting the value True and javascript apparently only accepts 'true' (in lower case). I don't want to hack the variable and make it a string and convert it to lower case in my action, but it looks like I have no choice? ...

How to get a dropdownlist to post a form in MVC

I've got a simple MVC view with a dropdown and a Submit button that posts the form and uses the value of the dropdown to change the view ("values" is populated in the controller): <% Using Html.BeginForm()%> <%=Html.DropDownList("values", "No value")%> <input type="submit" value="Submit" /> <%--rest of page here--%> <% End Using%> How...

MVC DropDownList parameter problem

The following dropdown does exactly what I want, but I'm looking for a simpler way to express it (note this is VB syntax). <%=Html.DropDownList("values", CType(ViewData("values"), IEnumerable(Of SelectListItem)), "No values", New With {.onchange = "this.form.submit();"})%> Because the ViewData value is named the same as the dropdown, ...

jQuery / ASP MVC -- parsererror in "$.ajax" calls

I'd like to create a simple action link in ASP.Net MVC RC2 using jQuery 1.3.1 - something like this: <a href="#" onclick="AjaxTest1()">Tester</a> with the AjaxTest1 function: function AjaxTest1() { $.ajax({ url: "Home/Ajax1", error: function(request, status, error) { ...

"'Sys' is undefined" error running ASP.NET MVC application in IIS7

Hi, I'm using the ASP.NET MVC in my web application. It uses AJAX (MicrosoftAjax.js, MicrosoftMvcAjax.js, jquery-1.3.1.min.js) to make the call from the view to the Delete action with this code: <%= Ajax.ActionLink("Delete", "Delete", new { id=item.id }, new AjaxOptions { Confirm = "Are you sure you want to delete the record?", HttpMeth...

Is There a Good CMS to Use with ASP.Net MVC

I have a small site I developed for a friend that uses ASP.Net MVC and was wondering if I could hook it up to dotnetnuke or another CMS. Or is doing an admin site using dynamic data? ...

Starting with / converting to ASP.NET MVC

I don't know much about MVC, but I have a project where I think I could use a lot of the functionality of ASP.NET MVC based KIGG. At the same time I have a HTML/jQuery based template. How should I approach this? What I am kind of hoping is that I can easily pick Views with behindlaying objects from KIGG, and then easily modify it. Is...

Validation, what checks do you typically perform in your web apps?

I'm building a publicly available web app. Because of this, I'll be validating every field as exhaustively as I can. I mean, if someone enters something that isn't valid, they will know exactly what it was (making it clear what they need to fix). I've followed Scott Guthrie's examples in the NerdDinner eBook. I love the idea of having a...

Controller/Routing Errors with js, img files using a CommonServiceLocator ControllerFactory

I've set up an ASP.NET MVC RC2 application to use a custom controller factory backed by a CommonServiceLocator (using StructureMap). Routing to and instantiating controllers works fine, but for some reason I'm getting exceptions when trying to access .js, .jpg, or any other static file. Here's the ControllerFactory code: public class ...

Tired of ASP.NET, which of the following should I learn and why?

Which of the following technology is easy to learn and fun for developing a website? If you could only pick one which would it be and why Clojure/Compojure+Ring/Moustache+Ring Groovy/Grails Python/Django Ruby/Rails Turbogear Cappuccino or Sproutcore Javascript/jQuery ...

ASP.NET MVC RC2 template head after body?

When I installed ASP.NET MVC RC2, I noticed that the template had changed from RC1. Now, all new views have the header placeholder after the main content place holder. Why is this? It seems very illogical to me and it most definitely was not the case with RC1. I googled but couldn't find any reasoning for this change. Do you know of any?...

ASP.NET MVC – Mock Membership for Controller Test

I’m not sure how to mock an ASP.NET Membership for my controller test. Controller Code: MembershipUser username = Membership.GetUser(); string UserID = username.UserName.ToString(); Does anyone know how to mock this for a controller test? I'm using RhinoMocks. ...

ASP.NET MVC IIS7 Better configuration

I have a simple but script and css fashioned ASP.NET MVC Application, within the VS2008 Development server everything goes well, but when I bring it to IIS7 I experiment some ugly script and images issues.. Scripts are not found by relative paths (this expecially in the default routed page) and images too. After some research and googli...

Know any ASP.NET MVC web hosting in Europe?

Are there webhosting plans for MS ASP.NET MVC (we are attending the official release, I know..)? ...

Where to put my siteLanguage parameter (cross cutting concern?)

In my project every page is translatable in several languages. For that purpose, I pass a sitelanguage parameter to each action. My custom base controller class catches this "siteLanguage" parameter and takes care of the further translation logic. This works allright, only thing is now I have to add a string called sitelanguage to every...

MVC Html.CheckBox and form submit issue

Crazy issue with submitting of values in Html.Checkbox in ASP.NET MVC RC Some of the values are just not come to Request.Params At my form I have this line inside the cycle: <%=Html.CheckBox("cb" + p.Option.Id, p.Option.IsAllowed, new { value = 6 })%> and it renders to next: <input checked="checked" id="cb17" name="cb17" type="...

How to associate labels with radio buttons

I'm using MVC, and I've got a simple radio button setup: <%=Html.RadioButton("my_flag", True)%><label>Yes</label> <%=Html.RadioButton("my_flag", False)%><label>No</label> The only thing I'm missing is that you can't click the label to select the radio button. Normally you'd use: <label for="my_flag"> but that associates both labels...