asp.net-mvc

asp.net mvc clearing a form after post

I'm a .net programmer, but new to mvc. I created a new mvc page with a simple form on it - 2 textboxes and a submit button. Upon posting, it goes to my server side method, where the user info is entered into the db, and then I want to return the user to the same exact form but empty again. When I use "return View("Index", new myIndexOb...

Does a worker process share its output cache within an AppPool?

Summary: I have an ASP.NET MVC website in IIS named 'Website' using an AppPool named 'WebsiteAppPool'. WebsiteAppPool is configured to allow up to 4 Worker Processes, in effect creating a 'Web Garden'. The Website is also configured, via web.config, to enable OutputCaching using CacheProfiles. <caching> <outputCacheSettings> <out...

Searching A Parts Table Using ASP.net MVC and ADO.net Entity Data Model gives Error Object Reference not Set to Instance of Object

Good Morning All, I am developing a new ASP.net MVC web application. Part of it's functionality is to search the Parts List on the SQL Server database. I have created a ADO.net Entity Data Model as part of the solution and named it PartList. I'm using master pages and want the search control rendered on it. As such, I've created Par...

MVC not rendering model properties in text box

I'm using MVC to create a few simple CRUD pages. I have a stringly typed user control which I include in my Create and Edit views which looks like this: <% using (Html.BeginForm()) {%> <div class="form"> <%:this.Model.Title%> <p> <label for="Title">Title:</label> <%= Html.TextBox("Title", this.Model.Title) %> ...

MVC View POST calls new constructor instead of passing back model

I've got a view which is adding a bunch of data into a bound EditModel. However, when it is POSTed, for some reason a parameterless constructor is called before calling the POST Action, instead of just passing back the model that was bound to the view. I thought all I had to do was to make sure I reference the model in the "Inherits" ta...

How to tell MSBuild where to put my compiled files?

Hi, I'm trying to use Nant to compile an ASP.NET MVC app, so far my build script just runs ms build and runs some other tasks, however I want my compiled files to be put in a "build" directory, how can I tell msbuild where to put the compiled files? ...

How do I get MVC to return a Context type

I have the following code I wrote in Asp.NET and I am trying to convert it to MVC, but not sure how I do this within an Action HttpContext context; context.Response.ContentType = "application/pdf"; context.Response.AppendHeader("Content-Disposition", String.Format("attachment;filename={0}", filename)); context.Response.WriteFile(filena...

Why in IE8 <script /> won't work with jquery?

Hi guyz, I have a website using ASP.NET MVC, everything was working fine, but I'd like to add some jquery stuff, then I imported the .js in my master page and when I run it my page doesn't work in the Internet Explorer anymore, I only get the background color. In Google Chrome it works nice, so in Firefox. Then I got a look in some page...

Like Html.RenderAction() but without reinstantiating the controller object

I like to use the RenderAction extension method on the HtmlHelper object to render sidebars and the like in pages, as it allows me to keep the data access code for each such part in separate methods on the controller. Using an abstract controller base, I can define a default "sidebar strategy", which can then be refined by overriding the...

Access to session when making ajax call to Asp.net MVC action

Hi, i have a controller action being called using an ajax request, but when i tried to access session (HttpContext.Session["key"]), i dont have any of my session keys populated. How can i have access to my session keys when i make a call using ajax. ...

ASP.NET MVC - PartialView Architectural question

This is more of a architect question rather than one that requires code. I have a page that requires me to display the status of a particular project. Let's say for the sake or brevity that there are two states, Open and Closed. When the project is open I want to display a PartialView showing me one set of details. If the project is ...

Getting SelectedValue back from a DropDown in ASP.NET MVC (C#) using Entity Framework

Sorry if this is a repeated question, I scanned the related questions and didn't see anything obvious. I'm using an EditModel with an Entity object, along with two SelectLists in it. The problem is, once I reach my POST action, the SelectedValues for both drop downs are still the same default values I set in the constructor for the mode...

MVC2 Validation - "A value is required"

I have a view model with 2 properties that are optional - ie - not required. The view uses dropdownlistfor() to get values for these two fields, an includes an optionlabel of "" for the blank value. When posted back to the create action the ModelState has an error for both of these fields saying "A value is required". Anyone got any cl...

SecurityExceptions using the HTML Helpers in third-party libraries

Can someone explain this paragraph on page 258(Pro ASP.NET MVC 1.0 Chapter 6: Using the HTML Helpers)? If you're writing a third-party library(as opposed to a web application) that uses the HTML helpers, never call the overloads that accept anonymous objects. Always call the overloads that accept dictionaries. Otherwise...

are there any good web third party tools to do excel like pivot tables

i am using asp.net mvc so the solution can be either server side or client side (jquery, etc). i can't seem to find any good tools that can mimic excel pivot tables (allow user to get the pivot table experience that they get with excel pivot tables) on the web with good performance. ...

Where to form html when using asp.net mvc and jquery?

I am currently working on some prototypes for a web site I am wanting to create. Part of the web site is going to be pretty heavy with javascript. Right now I am learning the jquery and ASP.Net MVC framework combo. The issue I am having is where I should be forming the html generated for ajax requests. For example on page load I want ...

Usefulness of asp.net MVC framework as opposed to coding MVC style with regular asp.net?

I am new to the asp.net world (but not new to .net) and I have been playing around with various things to see how I want to architect a web application I am developing. In my playing around I have decided I did not want to use asp.net's controls, as I have done enough php and ruby on rails to be decently familiar with regular HTML, and ...

Exceptions in System.Web.Routing.RouteCollection.GetRouteData

I've been getting two exceptions at random times in my asp.net mvc code running on iis7: Exception type: InvalidOperationException Exception message: Collection was modified; enumeration operation may not execute. at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) at System.Collections.Generic.List...

Extended function jquery

I have a function that looks like this: jQuery.fn.menuFunc = function( settings ) { settings = jQuery.extend({ actionAddURL:"", actionModifyURL:"", ........ },settings);}; where all the parameters i initialize (actionAddURL, actionModifyURL, etc..) are strings (ids of different elements...

How to handle local and global resources outside of the web project with ASP.NET MVC

I am currently in a couple of minds about how to organize local and global resources inside an ASP.NET MVC project. My current thinking is to have a global resource file and to separate local resource files by the controller. I have chosen the controller so that I can group any resources I need for any of the views which use the said c...