asp.net-mvc

Visual Studio ASP.NET MVC project: setting the start URL

Consider an ASP.NET MVC 2 project with VS 2010. The goal is to set the 'start URL' on run/debug using VS's built-in Cassini web server. Entering the URL as I want to be loaded, in the typical & valid format, controller/action, VS 2010 gives this exception. Tried Remedies: starting the URL with and without a slash ending the URL wit...

Execution flow in MVC

Hi all, I am trying to learn MVC in detail, and I am wondering whats the exact functional flow internally, in the sense of which functions(important functions) are called and what they does when the application starts and which function are called apart from the controller actions that we write in our application as we proceed. Help in...

How can I prevent some of my views in ASP.NET MVC from being cached?

I have a view that shows a list of items and when you click on one of them it will take you to the items page. I also store a "Viewed" flag in the database for that item. Now, when the user clicks back, the item should be styled differently because of the change in the "Viewed" flag. However, every time I click back, it is as it was b...

What's the best way to use a YUI TabView in an ASP.NET MVC app?

I'm creating an ASP.NET MVC web app and would like to use the YUI TabView (because I generally like its default look and I'm using a couple other YUI things, so the additional overhead will be comparatively small) to render a set of tabs in the master page. Here's what I want: Each tab should render the result of a particular controll...

ASP.NET MVC. Validation fails on dropdown no matter the value.

I've got a form with a dropdownlist in my MVC app. Now that I'm trying to add validation to the mix it seems that a dropdownlist fails validation no matter what it's value is. Without the validation it will allow the controller to work and redirect as planned. With the validation it does seem to allow the database changes to occur but M...

Redirect to Home/Index when page not found

This has already been asked here but I was hoping there was a nicer "routing" way to do this. Essentially I want to redirect to the Home/Index page when a user enters an incorrect url in my site. EDIT I'm using IIS. ...

Trouble with MVCContrib InputForm<T> and SparkViewEngine

I am trying to use MVCContrib InputBuilders but I am having trouble. I am also using S#arp architecture and spark. My spark view looks like this: new.spark: <viewdata model="NewUserViewModel" /> ${Html.InputForm<NewUserViewModel>()} My global.asax.cs contains: protected void Application_Start() { XmlConfigurator.Configure();...

How do I update an Entity Reference using a SelectList in edit form?

This is a follow-up to the discussion in this post. I am not sure how to ask the follow-up question in a 2-month-old thread; so I apologize if there is a better way. Anyway, to reiterate I have an ASP.NET MVC Edit form, and one of the fields is a select list. I get the values fine, but I am having trouble to update the primary entity af...

How do you link from one group to onather in aspnet mvc

i am new to aspnet mvc, and I have just completed the nerddinner tutorial. What I am wonting to do is have it so the user would land on the home page, the home page should show five professions, painters, builders, electricians, plasters and roofers. Then I wont those five categories to be links, and when you click them, they take you ...

How to use EditorFor inside a foreach

I have a model: public class MyListModel { public int ID {get;set;} public List<User> Users{get;set;} } How do I use the Html.EditorFor method inside a foreach? <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MyListModel>" %> <table> <tr> <th></th> ...

Recommended url structure for parent child list in mvc

If I am listing child items of a parent in an asp.net mvc app, is there a best practice to how the url structure should be formed? Example: 1. http://app/parent/&lt;parentID&gt;/children 2. http://app/parent/children/&lt;parentID&gt; I'm personally more inclined to choose option 1, but am wondering if there is a particular way that...

Do not show the selected item of first dropdown in second dropdown

I have two dropdownlist which shows places in my asp.net MVC(C#) application. The First dropdownlist is to show the "From Place" and the second dropdownlist is to show the "To Place". The list of Places are say like : Alabama Alaska California Maryland,..... The From and To Place dropdownlists contains the above places. When i ...

Best way to maintain and develop 3 similar sites

It would kind of be like S[OFU] except there will be more differences between the site. What are good ways to develop 3 site at once with a different look and different functionality? I believe with the look i may only change the CSS and some backend data for different categories. I also need some functionality and options to be specifi...

Storing state in asp.net MVC

I'm building an asp.net MVC 2 app. I have a list view which lists items based on a parameter. In the database I have a parent and child table, so my list view lists all the child records for where the parent's id matches the value specified in the parameter. This is my controller and model: public ActionResult List(int ParentID) { ...

Passing parameterized list to view in MVC using Entity Framework

In a MVC project am trying to create a view which has the Title from a parent table and the subsequent list below it from its related Child table. I pulled the tables into the project using Entity Framework and in the controllers namespace created the follwing Viewmodel: public class ServicesViewModel { public ServicesViewModel(Lis...

Where to put my custom Html Helpers ?

Where to put the helper class in the project folder hierarchy ? ...

Problem running ASP.NET MVC 2 website on IIS7

I'm trying to deploy my ASP.NET MVC 2 website from VS2010 beta 2 to IIS7. The publish works fine but none of the routes work, so when I go to the URL http://localhost/myapp/Home/Index I get the error: HTTP Error 404.0 - Not Found The resource you are looking for has been removed, had its name changed, or is temporarily unavaila...

Error Posting edit data in ASP.NET MVC

Can someone explain why the model object is null. I checked the post values coming across the wire and all of them are populated. Using VS2010 Beta 2,WinXp SP2,however this works in VS2008 ??!! Yellow screen of death message Server Error in '/' Application. Object reference not set to an instance of an object. Description: An u...

ASP.NET MVC - Version clarification

I am using VS 2008 and MVC 1.0. When i try to execute <%=Html.ActionLink("DisplayHello", new {Controller="SayHello",Action="DisplayHello"}) %> it throws System.Web.Mvc.HtmlHelper does not contain a definition for "ActionLink". I am using MVC Version System.Web.Mvc.dll (1.0.40310.0) Question What version do i need to upgrade? ...

Showing runtime genrated Image in MVC ASP.NET

Hi all, I have to show runtime genrated image on a View in ASP.NET MVC web application. please can you suggest me how should i rrender this image (should i use aspx or ashx file) Being new to MVC i am asking this foolish question ...