asp.net-mvc-2

How to use a Base ViewModel in Asp.net MVC 2

As I familiarize myself with Asp.Net MVC, I am using MVC 2, I have noticed the use of a BaseViewData class in the Kigg project which I am unsure how to implement. I want each of my ViewModels to have certain values available. Using an iterface comes to mind but I am wondering what the best practice is and how does Kigg do it? Kigg pub...

What are the best practices to persist`Conversational state' in ASP.NET MVC applications?

What is the ultimate workaround?) Desired scenarios are: Multistep forms. If a page has tabs on it, the tabs should persist their `viewstate' Whatever navigation user has chosen, it shouldn't affect (more appropriately, bother) the conversational state management. Those are just several aspects, but I find them much practically rele...

Problem Using Partial View In for each loop

I'm a little confused here, I am trying use a partial view in a for each loop like so <% foreach (var item in (IEnumerable<MVCLD.Models.Article>)ViewData["LatestWebsites"]){%> <% Html.RenderPartial("articlelisttemaple", item); %> <% } %> And my partial view looks like this <div class="listingholders"> ...

Using jQuery for client side validation in MVC2 RTM

Scott Gu's tutorial on Model validation gets us all set up with the MS client side validation using the following scripts: <script src="../../Scripts/jquery.validate.min.js" type="text/javascript"></script> <script src="../../Scripts/MicrosoftMvcValidation.js" type="text/javascript"></script> However I've seen various posts allowing u...

What are Html.Validate and Html.ValidateFor methods for?

I'm finding it hard to find out helpful information about ASP.NET MVC's validation HTML helpers - Html.Validate and Html.ValidateFor. Has anyone worked with these methods? what are they for? ...

Why ASP.NET MVC 2 hasn't default.aspx and didn't work?

Why Default.aspx missing if I created ASP.NET MVC 2 project? And why this project didn't work on IIS? ...

ASP MVC 2: Regular expression attribute working on clientside but not on serverside

[Required(ErrorMessage = "Date is required")] [RegularExpression(@"^(((0[1-9]|[12]\d|3[01])\/(0[13578]|1[02])\/((1[6-9]|[2-9]\d)\d{2}))|((0[1-9]|[12]\d|30)\/(0[13456789]|1[012])\/((1[6-9]|[2-9]\d)\d{2}))|((0[1-9]|1\d|2[0-8])\/02\/((1[6-9]|[2-9]\d)\d{2}))|(29\/02\/((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26...

Altering the ASP.NET MVC 2 ActionResult on HTTP post

I want to do some processing on a attribute before returning the view. If I set the appModel.Markup returned in the HttpPost ActionResult method below to "modified" it still says "original" on the form. Why cant I modify my attribute in a HttpGet ActionResult method? [HttpGet] public ActionResult Index() { return Vie...

asp.net mvc tree view with checkbox

Ok I am looking for a solution in mvc2 where i can have tree view generated where after that i can checked the nodes I want to enter the value in the database. Can anyone point me to something? Basically I am assigning features to a particular group.(I have a group admin whom I can assign the manage user add edit delete,manage groups de...

ASP.Net MVC Object Reference in Edit View when using DropDownListFor()

This question is related to another I ask recently, it can be found here for some background information. Here is the code in the Edit ActionResult: public virtual ActionResult Edit(int id) { ///Set data for DropDownLists. ViewData["MethodList"] = tr.ListMethods(); ViewData["GenderList"] = tr.ListGenders...

changing trigger event of MVC 2 client validation

Hi Everyone i m developing a website using .NET 3.5 with MVC 2.0. For server side validations i m using ComponentModel.DataAnnotations. these validations are reflected to client side by html helper's method Html.EnableClientValidation(). this scheme works fine for except that it triggers the validation on blur event of each form control...

Bind ISet in ASP.NET MVC2

Hi, I am trying to find out what would be the best way to bind first element of ISet (Iesi.Collection) as a first element. So basically I only have to use some kind of collection that has an indexer (and ISet doesn't) then I can write code like this (which works perfectly well): <%: Html.EditorFor(x => x.Company.PrimaryUsers[0].Email)...

ASP.NET MVC2 - usage of LINQ-generated class (validation problem)

There are few things not clear to me about ASP.NET MV2. In database I have table Contacts with several fields, and there is an additional field XmlFields of which type is xml. In that field are stored additional description fields. There are 4 classes: Contact class which corresponds to Contact table and is defined by default when crea...

Asp.Net MVC2 Clientside Validation problem with controls with prefixes

The problem is: when I put 2 controls of the same type on a page I need to specify different prefixes for binding. In this case the validation rules generated right after the form are incorrect. So how to get client validation work for the case?: the page contains: <% Html.RenderPartial(ViewLocations.Shared.PhoneEditPartial, new Ph...

Display custom error page when file upload exceeds allowed size in ASP.NET MVC2

Hello! My main issue is that I want to display an custom error page when an uploaded file exceeds allowed size (maxRequestLength in web.config). When the big file is uploaded an HttpException is thrown before my upload action method in the controller is invoked. This is expected. I have tried to catch the exception in a custom attribu...

Paging more than one collection on a single page in asp.net mvc.

I'm building a search engine for documents using asp.net mvc. The results of the search are two different IList collections (One for the people matched and one for the documents matched with the search parameters). I put these collections in a class and return the class to the view. The view uses HTML.RenderPartial() to bind the respe...

Bug in MvcFutures LinkBuilder.BuildUrlFromExpression

I hope this is the right place to post this. The following code fails in the latest build of the MVC futures library. This works and correctly calls my controller: Html.ActionLink<CreatePlayerController>(x => x.PlayerDetails(), "Click") This fails: LinkBuilder.BuildUrlFromExpression<CreatePlayerController>(null, Html.RouteColl...

Can you point me to current examples using NHibernate in an ASP.NET MVC2 app?

Can anyone point me to any self-contained, complete, current reference materials/projects using NHibernate in an ASP.NET MVC2 application? I have looked at Sharp Architecture, but I am not sure I need the complexity in that project. I certainly don't know enough about it to know if it is over-engineered for my purposes. I would like to...

Custom model in ASP.NET MVC controller: Custom display message for Date DataType

Hi I have an ASP.NET MVC Page that i have to display the fields in customized Text. For that I have built a CustomModel RequestViewModel with the following fields. Description, Event, UsageDate Corresponding to these my custom Model has the below code. So that, the DisplayName is displayed on the ASP.NET MVC View page. Now being ...

The Purpose of a Service Layer and ASP.NET MVC 2

In an effort to understand MVC 2 and attempt to get my company to adopt it as a viable platform for future development, I have been doing a lot of reading lately. Having worked with ASP.NET pretty exclusively for the past few years, I had some catching up to do. Currently, I understand the repository pattern, models, controllers, data ...