asp.net-mvc-2

sending parameter to another action as querystring not form parameter

hi, i have a form that have a field which hold query for search and a button to send query value to another action method to perform search. now i want to send this parameter as querystring; not form parameter. but when i click on submit button it's value isn't shown on address bar and sended as form parameter. <% using (Html.BeginForm(...

How to turn off https security risk related messages on ASP.NET MVC page?

Hi We have a secured website using ASP.NET MVC Framework. The User session timeout is implemented using JQuery IDLETIMEOUT plugin. So that If the session timeout is set for 30 min, it displays a message "You are about to be Signedout due to inactivity" with "Stay Logged on". This popup Message displays for last 30 sec and if the user c...

How to reference other Areas?

Hi, I have a controller called "Account" in my main site and I would like to reference a method on it from with in an Asp.net MVC 2 Area. It seems by default that Areas only have access to the controllers within that Area which makes sense, but there doesn't seem to be an option to reference controllers from another area. Thanks! ...

ASP.NET MVC 2 - ViewData empty after POST

I don't really know where to look for an error... the situation: I have an ASPX view which contains a form and a few input's, and when I click the submit button everything is POST'ed to one of my ASP.NET MVC actions. When I set a breakpoint there, it is hit correctly. When I use FireBug to see what is sent to the action, I correctly see...

DataAnnotations - Disallow Numbers, or only allow given strings

Is it possible to use ASP.NET MVC 2's DataAnnotations to only allow characters (no number), or even provide a whitelist of allowed strings? Example? ...

Include HTML file as embedded resource

A followup to another question I did, I've done some more digging but I am still coming up dry. Is there any way to include .HTML/.ASPX files as 'embedded resources' into an ASP.NET MVC application? I've found lots of examples of using string resources, but never other files entirely. ...

ASP.NET MVC 2: Data DataAnnotations validation be convention

I have a required attribute that used with resources: public class ArticleInput : InputBase { [Required(ErrorMessageResourceType = typeof(ArticleResources), ErrorMessageResourceName = "Body_Validation_Required")] public string Body { get; set; } } I want to specify the resources be convention, like this: public class ArticleI...

Custom JsonSerialization

Hi, I have a simple class in asp.net mvc that looks like this: public class JsonResponseItem { public string Key { get; set; } public string Value { get; set; } public JsonResponseItem(string key, string value) { Key = key; Value = value; } } In my controllers I create a list of that type Li...

Asp.net mvc2: How to add validation rules - A number field is not required but has range limitation?

Asp.net mvc2: How to add validation rules - A number field is not required but has range limitation? ...

MVC2 Inline XHTML Validator?

I am attempting to setup http://www.thejoyofcode.com/Validator_Module.aspx on a local MVC2 project. I have followed all of the steps listed in the setup guide but I cannot get the validator to kick in. If I create a bog standard .htm file or a webform with .aspx extension, I can get it to work. Anyone had any joy with this? ...

Why model => model.Reason_ID turns to model =>Convert(model.Reason_ID)

I have my own html helper extension, wich I use this way <%=Html.LocalizableLabelFor(model => model.Reason_ID, Register.PurchaseReason) %> which declared like this. public static MvcHtmlString LocalizableLabelFor<T>(this HtmlHelper<T> helper, Expression<Func<T, object>> expr, string captionValue) where T : class { return...

ASP.NET MVC 2 strange behavior

Hi Recently I installed VS 2010 Release (migrated from RC) and my MVC application is not working anymore. More concrete: I have a wizard with several steps for new customer account creation (Jquery form wizard, but it doesn't really matter). Each step contains a typed partial View for each part of account: Company, Customer, Licence, etc...

ASP.NET MVC URL Routing problem

hi, i have defined a route as below: context.MapRoute("SearchEngineWebSearch", "search/web/{query}/{index}/{size}", new { controller = "search", action = "web", query = "", ...

ASP.NET MVC 2 UpdateModel() is not updating values in memory or database

Hello, I am new to MVC, and so am working through the NerdDinner tutorial, here. In particular, I'm running into problems with the use of the UpdateModel method, which is explained in the part five of that tutorial. The problem is, when I try to edit the value of a dinner object using the UpdateModel method, the values do not get update...

ASP MVC2 - Dynamic Field Layout

I'm new to MVC and ADO.net Entity Framework. Instead of having to create an edit/display for each entity, I'd like to have the controller base class generate the view and validation code based off metadata stored in a table - something along those lines. I would imagine something like this has already been done, or there are good reas...

MVC Validation in Model

I'm currently using DataAnnotations to validate my MVC 2 app. However, I've ran into a small problem. I currently have an object of type User which has a number of properties. All of which are required. public class User { [Required(ErrorMessage = "Username is required")] public string Username { get; set; } ...

How to store account-specific information in ASP.NET MVC 2

I have an ASP.NET MVC 2 web application. There are two tables like "FIRST_KIND_OF_USERS" and "SECOND_KIND_OF_USERS". Both are mapped to the default aspnet_users table via UserId column. Each of them has it's own integer primary key column like "FirstKindOfUsersId". When a user is trying to add some data to the database, for instance, "C...

DataAnnotations validation and custom model binder

I have an action method that accepts the following model - LanguagesViewModel: public class LanguagesViewModel : ViewModelBase { IEnumerable<LanguageItem> Languages { get; set; } } public class LanguageItem { [Required] public int LanguageId { get; set; } [Required] public int SpeakingSkillId { get; set; } [Required] public in...

Updating database row from model

Hey everyone, I'm haing a few problems updating a row in my database using Linq2Sql. Inside of my model I have two methods for updating and saving from my controller, which in turn receives an updated model from my view. My model methods like like: public void Update(Activity activity) { _db.Activities.InsertOnSub...

PathTooLongException after migrating from ASP.NET MVC 1 to ASP.NET MVC 2

I had updated my app from MVC 1 to MVC 2. After that some pages throws PathTooLongException: [PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.] System.IO.Path.SafeSetStackPointerValue(Char...