asp.net-mvc

Why does __VIEWSTATE hidden field gets rendered even when I have the EnableViewState set to false

I saw that __VIEWSTATE field gets rendered even though I have set the EnableViewState="false" at the page level. This field is not rendered if I remove runat="server" tag for the form element. Can somebody please explain this? ...

ASP.NET MVC UpdateModel with a sorta complex data entry field

Hi folks, how do i do the following, with an ASP.NET MVC UpdateModel? I'm trying to read in a space delimeted textbox data (exactly like the TAGS textbox in a new StackOverflow question, such as this) into the model. eg. <input type="Tags" type="text" id="Tags" name="Tags"/> ... public class Question { public string Title { get;...

ASP.NET MVC AcceptVerbs and registering routes

Hi Folks, do I have to register the HttpVerb constraint in my route definition (when i'm registering routes) if i have decorated my action method with the [AcceptVerbs(..)] attribute already? eg. i have this. [AcceptVerbs(HttpVerbs.Post)] public ActionResult Create(FormCollection formCollection) { .. } do i need to add this to the r...

ASP.NET MVC - .mvc Routing just fails in II6

Hi, I have been banging my head against a brick wall trying to deploy my MVC app on IIS6 (linked question) I have scrapped wildcard mapping for the time being and am trying to get the .mvc extension working. Everything is configured correctly in IIS and the .mvc extension is pointing to the .NET dll for all verb types (unchecked verify...

Iterating through anonymous typed data in MVC view

Into some view data i have put the result of an anonymous type: var projectData = from p in db.Projects orderby p.title select new { Title = p.title, DevURL = p.devURL ?? "N/A", ...

Paged table with ASP.NET MVC and AJAX

I'm looking for good patterns for implementing a paged table of results in ASP.NET MVC with sorting, filtering, and paging provided via AJAX. It seems to me that I should have my controller actions provide only the data and not mark up to maintain the separation of concerns -- so the Ajax callback would provide new table data and pager ...

How can I test ModelState?

How can I test Controller.ViewData.ModelState? I would prefer to do it without any mock framework. ...

ASP.net MVC: Getting a Partial View's HTML from inside of the controller

I have developed a simple mechanism for my mvc website to pull in html via jquery which then populates a specified div. All is well and it looks cool. My problem is that i'm now creating html markup inside of my controller (Which is very easy to do in VB.net btw) I'd rather not mix up the sepparation of concerns. Is it possible to use ...

New features you would like to avail in ASP.NET MVC

What are the new features you would like to avail in ASP.NET MVC in the future releases? I Would say 1) A separate view engine for ASP.NET MVC instead of current WebForm view engine. 2) Asynchronous Controller Actions. 3) Subcontrollers / Partial Requests. ...

OnActionExecuting(FilterExecutingContext) doesn't exist in System.Web.Mvc anymore?

Hi, In preview 5 I was overriding the OnActionExecuting in my custom controller class, but now for some reason in beta it is giving me an error saying the parameter FilterExecutingContext doesn't exist? protected override void OnActionExecuting(System.Web.Mvc.FilterExecutingContext filterContext) What is the parameter now? ...

Get value from dropdownlist en use value in UrlHelper

I would try something like this but it isn't allowed. function GetDynamicModulesProperties() { var selectedValue = $("#moduletype option:selected").val(); if (selectedValue.lenght() > 0) { var url = '<%= Url.Action("GetModuleProperties", new { sectionid = ViewData.Model.Id, moduleTypeId = selectedValue } ) %>'; ...

Html.BuildUrlFromExpression with reference type parameters for action

I hope my terminology is right. Edit if not. From my Linq2Sql classes I have a Color class. One of my controller's actions accepts an instance of this Color class. I want to create a link to this action so I use <%=Html.ActionLink<ColorController>(c=>c.Details(ViewData.Model.ActiveColor), "test")%> Where ViewData.Model.ActiveColor ...

ASP.Net MVC Loading In Progress Indicator

I have an MVC Controller that runs through a process, sets some View Data, and then returns the results of this data back to the user in a View. The process time is dependent on the amount of data that is being processed. I need a good way to display an animated .gif within the View while the process is running, letting the user know t...

How to make 4 columns across in ASP.NET MVC - How to make my current code suck less

I have the following code, I'm trying to get a table with 4 columns across. If I run out of columns, create a new row and make 4 more coumns. rinse. lather. repeat. <tbody> <% int i = 0; foreach (ItmXtnMultimedia multimedia in ViewData.Model.ItmXtnMultimedia) { if (i%4 == 0 && i== 0) { %><tr><% } if (i%4 == 0 && i != 0) { ...

Insert into multiple database tables using Linq, ASP.NET MVC.

I have a rather simple scenario where I have two tables in which I want to add data. They are managed with primary key/foreign key. I want to add new data into TABLE A and then retrieve the Id and insert into TABLE B. I can certainly do it with a stored procedure, but I'm looking at trying to do it using Linq. What is the best approa...

An easy way to set the active tab using controllers and a usercontrol in ASP.NET MVC?

How do I create tabbed navigation with the "Current" tab highlighted in the UI? ...

ASP.Net MVC Output Caching: The directive or the configuration settings profile must specify the 'varyByParam' attribute.

I encountered the above error message after applying the OutputCache attribute on ActionResult methods with no input parameters - why would I use VaryByParams in this case? Is this a bug in ASP.Net MVC or is there a way of using OutputCache without setting this property? My big question is, if I have to use VaryByParams, what should I e...

MVC actions, should I create 2 actions for logging in?

Hi, In asp.net mvc, I want to create a action for login. So this is how I am doing it: create a action/view named login that simply displays the view. create another action, named login2 that will be the page that handles the form post and checks the database if the username/password are correct. If it is, redirect to somepage, if n...

ASP.NET MVC US State Drop Down List

anyone have have a dropdownlist helper method with a list of US states? thanks. ...

ASP.NET MVC Editing A Collection Best Practices - Your Opinion

Given the following class, what is your opinion on the best way to handle create/edit where Attributes.Count can be any number. public class Product { public int Id {get;set;} public string Name {get;set;} public IList<Attribute> Attributes {get;set;} } public class Attribute { public string Name {get;set;} public string Val...