asp.net-mvc-2

ASP.NET MVC and ViewState

Now I've seen some questions like this, but it's not exactly what I want to ask, so for all those screaming duplicate, I apologize :). I've barely touched ASP.NET MVC but from what I understand there is no ViewState/ControlState... fine. So my question is what is the alternative to retaining a control's state? Do we go back to old schoo...

using Html.EditorFor with an IEnumerable<T>

I have a custom class: public class Person { public String Name { get; set; } public Int32 Age { get; set; } public List<String> FavoriteFoods { get; set; } public Person() { this.FavoriteFoods = new List<String>(); this.FavoriteFoods.Add("Jambalya"); } } I pass this class to my strongly typed ...

Missing Classes and Methods in ASP.net MVC 2

I download asp.net mvc2 preview 2 days back. I've just started studying MVC. I tried to create a page to display Product details from AdventureWorksLT database. There is an Image in it (stored as byte[]). After googling for sometime I got some help and a few links from SO and other sites. There is one very nice post about doing this with...

Rendering the field name in an EditorTemplate (rendered through EditorFor())

I'm currently building the Admin back-end for a website in ASP.NET MVC. In an ASP.NET MVC application, I've started using the 'EditorFor' helper method like so: <div id="content-edit" class="data-form"> <p> <%= Html.LabelFor(c => c.Title) %> <%= Html.TextBoxFor(c => c.Title)%> </p> <p> <%= Html.Label...

Redirecting to specified controller and action in asp.net mvc 2 action filter

I have written an action filter which detects a new session and attempts to redirect the user to a page informing them that this has happened. The only problem is I can not figure out how to make it redirect to a controller/action combo in an action filter. I can instead only figure out how to redirect to a specified url. Is there a d...

how to set an mvc object to a variable within webform

I have an MVC application with a link to print the information. the print link is inside a javascript. code as follows: <td> <%= Html.TextBox("Name", Model.ApplicantStatus.Name) %> <%= Html.ValidationMessage("Name", "*") %> </td> <script type="text/javascript"> var myEmail = "[email protected]"; var mySubject = "Sample"; var myBody = "...

ASP.NET MVC 2 - Implementing custom Metadata and Validator Providers

With the preview 2 release of ASP.NET MVC 2, we now have base classes to implement our own custom providers for metadata and validation. Specifically, with ModelMetadataProvider and ModelValidatorProvider. There isn't a lot of documentation on these yet (just released yesterday as a preview, so I'm neither surprised nor disappointed). ...

XmlSerializer under Medium trust bombs

I am having trouble using XmlSerializer with medium trust in my ASP.NET MVC 2 application. The stack trace is: [SecurityException: That assembly does not allow partially trusted callers.] Bactum.PracticeTesting.MultipleChoiceQuestion.set_Prompt(String value) +0 Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderQ...

Having trouble deplying ASP MVC app to normal shared hosting provider

I bought the Windows Developer hosting package from fasthosts.co.uk, which I believe is a bog standard shared hosting package. It has ASP.NET 3.5 and, according to their support, also has SP1 installed. I have developed my web app using ASP MVC 2 preview 1 (which by the way is awesome and I'm looking forward to getting stuck into previe...

href path in aspx files in area

Hi I am continually testing the new feature of ASP.NET MVC 2 Preview 2 called: "Areas within one project". Currently I have a problem with linking to css and js files from within aspx code. When the url points to an url without the id, everything works fine: http://mysite.com/area/controller/action The problem appears when the url...

keep track of user progress without requiring login asp.net mvc

I created a website which loads an a question pool from an XML file and generates random tests for my users to practice for an exam. Some of the tests take a while for the user complete, and they may not finish it all in one sitting, so I would like for people to be able to come back later and finish up their tests during multiple sessi...

Why don't themes sit well in the MVC paradigm?

I am working with the new ASP.NET MVC areas and mixing it with themes. In MVC without areas I used to apply themes by adding <pages theme="ThemeName" ... > ... </pages> to the Web.Config in the Views folder, and it worked perfectly. Now that I have an Areas folder, each with its own Web.Config, my theme is only applying to controlle...

object Model types in MVC2 using strongly typed view pages problem.

I have a new converted MVC2 project running against the MVC2 source code. I have done this conversation twice on the same solution. I use strongly typed views on every page of the site and so far I haven't had any issues running against the source nor developing with strongly typed views. Now on one strongly typed view in particular t...

Paging in asp.net-mvc-2

I have been using the excellent IPagedList from Martijn Boland paging method for MVC1 for some time now to good effect. I have just attempted to use it with Haacked's Default Templated Views in MVC2 and have found that it causes problems. Specifically, when calling: <%= Html.Display("SomeViewDataKeyToAnIPagedListCollection") %> from ...

Should MVC 2 - Preview release be easily upgraded to Beta when it's released?

Should I just be able to install the beta on top of this without problems when it is released ? Not sure how it is treated within the visual studio environment. I'm thinking with it being a type of project in VS it should be ok. Can anyone clarify? MVC 2 is looking to be rather good from what I heard from Scott Gu @ the Manchester co...

Concerning Major Changes to a Project

Whats the best way to go about upgrading a project with major design changes...in terms of project files (I guess)? I recently moved my website from ASP.NET to ASP.NET MVC and it was obvious that changes were so major it required a complete rewrite. Now I am preparing to move it to MVC 2, to take advantage of more features of the new f...

Strongly-typed views in ASP.NET MVC 2.0 Preview 2 no longer function

I had a functioning ASP.NET MVC 1.0 Project with strongly typed views. They no longer function after upgrading to ASP.NET MVC 2.0 Preview 2. The Model property now is an Object instead of the requested type. I have this: <%@ Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<TechHelp.Core.Models.Ticket>>" %> I g...

Using EditorFor<> to render a drop-down list

So far we can use Html.EditorFor() to dynamically render the appropriate template for a datatype - e.g. string, int, or a custom type, say 'Address'. Now I want to use EditorFor() to render a 'Parent' field. I want a drop-down containing every row, and the user picks a parent from this drop-down. The 'Parent' template has access to the...

ASP.NET MVC: Is Data Annotation Validation Enough?

I'm using the Data Annotation validation extensively in ASP.NET MVC 2. This new feature has been a huge time saver, as I'm now able to define both client-side validation and server-side validation in one place. However, while I was doing some detailed testing, I realized that it's quite easy for someone to bypass the server-side valida...

Asp.Net Mvc 2 reusable parts?

Hi there: I wonder, is there an equivalent of the Monorail View components for Asp.Net MVC? What I m trying to do is render some complex UI that depends on a class, so say we are in a List view, I want to pass an object to this ViewComponent equivalent and that it will take the object as a parameter and render the complex UI for me all...