asp.net-mvc-2

ASP.NET MVC 2 Filtering multiple drop down lists

I know how to approach this problem but i have very little experience dealing with anything web related. The situation is: I have a controller that returns a view with a user control in it. Inside the user control i have 3 drop down lists; one for companies, one for field offices and one for facilities. When the companies ddl is altered...

ASP.Net MVC Recaptcha and Strict Doctype

I am using this this Recaptcha approach in my MVC project however it does not validate to Strict 1.0 DOCTYPE. Can anyone help? Thanks ...

Creating own POCO classes wont work. ERROR Schema specified is not valid

When I try to create my own POCO classes I get this error. This is only when I got a list of some kind or acsosiation like in this case the Author got Books. But it works great when I use the T4. I kinda like to create my own classes because then I could add my AddBook() to it.. so I highly appreciate if anybody know why.. Schema speci...

Question about custom routing in ASP.NET MVC

Hi all, I have to admit in advance that I'm quite new to MVC, I've been going through the resources at www.asp.net/mvc, but I was wondering if you guys could help me with something. I have been asked to create a ASP.NET version of an existing PHP website, this website has a huge number of existing links to it in a particular format, wh...

showing image from imageBytes in ASP.net mvc

Hi, I am getting the list from the database with different types of data in the list i.e. string,int, date and imagebytes. In my partial view, I am looping through the list and displaying the data in the table. (ViewData["UserAlert"])%>--%> Image --%> Image ...

How can I change the ActionLink behavior?

Been new to MVC 2, how can we get a link as: http://localhost:13269/Terms instead http://localhost:13269/Frontend/Terms as this is the result of: <%: Html.ActionLink("Terms & Conditions", "Terms", "Frontpage")%> even if I don't specify the Controller like <%: Html.ActionLink("Terms & Conditions", "Terms")%> as I changed the rou...

The name RedirectToAction does not exist in the current context

Hello, i have a Log on in APS MVC 2.0 and if not logged on, i want to redirect the user to that page. i found the way to do it is usin the RedirectAction (found several times on google, even on stack Overflow) <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> <asp:Content ID="Con...

Issues with aspnetForm in hybrid asp.net webforms/mvc app

I am building a hybrid MVC/Webforms application where my MVC views are using an asp.net webforms 2 MasterPage. Everything has been working perfectly until I decided to put a form in my MVC view. Since ASP.NET Webforms wraps the entire page in a form element and you can't have a form within a form, I'm a little bit stuck. There are a lo...

MVC2 Custom Editor Template outer validation box

I've got a custom Editor Template that is essentially: <div id="control"> <%: Html.DropDownListFor(model => model.Day, Model.Days)%> <%: Html.DropDownListFor(model => model.Month, Model.Months)%> <%: Html.DropDownListFor(model => model.Year, Model.Years)%> </div> Whilst my validation is successful/fine with this control (ValidationMes...

Model Binding with Ajax Form

Hello Everyone, i m using asp.net mvc2 and i m submitting a form through ajax using jquery. in this scenario model binding does not work Here is my View code <%using (Html.BeginForm("MeetingTodo", "OA", FormMethod.Post, new { id = "TaskForm" })) {%><%=Html.Hidden("id",ViewContext.RouteData.Values["id"]) %> <div class="container...

How do you page IGrouping on the grouped items rather than the group

I'm trying to use skip and take on IGrouping but I don't want to page on the grouped key I want to do it on the items that have been grouped. ...

ASP.Net MVC - Images taking a long time to load

I have tested my pages in Firefox & IE and looking at Firebug in Firefox for some reason some images are taking a long time to load. They are not very big in comparison to the ones which are loading quicker. Attached is a screenshot of Firebug. I especially notice it in IE with the progress bar at the bottom of the page, it just sits ...

How UpdateModel method works in asp.net mvc 2

Hi, I want to know the working of UpdateModel() method. I just know about it is for update the current model data. but how it works exactly ? Because while I am using the UpdateModel() in edit controller method, there is functionality of file uploads. I am keeping the path of uploaded file in my db. but after executes the UpdateModel met...

How to hijack form submit event when triggered by dropdownlist change

On my webpage I am displaying a table of data and I want to give the user the ability to sort that data by using a dropdownlist (e.g. By FirstName, By LastName, By State etc...). I would like to use Ajax to load the sorted data into the data table without a page refresh. I'd also like to use javascript in an unobtrusive way so that the ...

DataAnnotations and FluentValidation not working in MVC 2 project

I have edited the original question since the same error is occurring the difference being the implementation, I have now added Ninject to the mix. I have created a class for the validation rules public class AlbumValidator : AbstractValidator<Album> { public AlbumValidator() { RuleFor(a => a.Title).NotEmpty(); } } I ...

After updating a model, the values don't reflect on the View

Hi All, I used Visual Web Developer 2010 and ASP .NET with MVC2 to create a simple Customer Management module, where the view will allow entering first name, last name, address, etc., and upon submitting, a new "ID" will be assigned to the CustomerID property of the CustomerModel instance. The Controller method (CustomerController) for...

Asp.net MVC2 - Multiple databases

I have a database called "Config" where I have a table called "Customer" In the Customer table I hold the login credentials, along with a connection String to the client's database. Inside of my controller I'm checking to see what customer database i'm querying String connectionString = ""; if (id == 1) conn...

MVC source code singleton pattern

Why does .net MVC source code ControllerBuilder use a delegate to assign the controller factory?: private Func<IControllerFactory> _factoryThunk; public void SetControllerFactory(IControllerFactory controllerFactory) { _factoryThunk = () => controllerFactory; } Why can't it just assign the ControllerFactory directly?, ie: privat...

.net mvc - deploy application

Hi, I have a .net mvc 2 application. What is the usual way to hand this application to our customer (similar like war file would be)? Can I just zip the publish-ed version of the app? Or are there any smarter ways to do it, and better ways to get there then to do a publish from VS? ...

Need to return shared partial view in contentresult

I've created a basecontroller class based of a blog post I found to return a partial view as a result in a ContentResult type action in my controller. The code for that is here: protected string RenderPartialViewToString(string viewName, object model) { if (string.IsNullOrEmpty(viewName)) viewName = Controll...