asp.net-mvc-2

MS Build Task - Copy Embedded Resources from DLL into directory

I am using the Yahoo! UI Library: YUI Compressor for .Net, and I also have Portable Areas. I would like to extract the JavaScript files from the Portable Areas DLLs into the site directory. For some reason, I am unable to extract any Javascript files :( The main piece that doesn't seem to work that I have seen work on forums is this l...

client side validation in ascx files (user controls) for asp.net mvc

hi, I have a logOn forn in ascx files and I render it as partial. How I can add a clinet side validation to this form, have any idea ? My below code does not work <%= Html.ValidationSummary(true, "Giriş başarısız oldu. Lütfen hataları düzeltip tekrar deneyin.") %> <% Html.EnableClientValidation(); %> <% using (Html.BeginForm...

Any JQuery time plugin available to select Time on ASP.NET MVC Page?

Hi I have an ASP.NET Page on which the user need to select the TimeSlot like 10:00 AM PST, 10:15 AM PST.... etc at a constant interval of 15 Min (Flexible). Using the JQuery datepicker, we can only select the date. I am wondering if there is any readily JQuery plugin available for Timeslots as well? Appreciate your responses. ...

ASP.NET MVC 2 Authorization Regex

What i currently have is the following: namespace AzureCCCMVC.Controllers { [Authorize(Roles="Admin")] public class AdminController : Controller { //Stuff } } what I want to do is have roles for each client such as Roles { "DEMOAdmin", "GOOGAdmin" , "MSFTAdmin" } and be able to Authorize The Client name (from URL...

Can we have any Blackout dates using JQuery UI Datepicker plugin on ASP.NET MVC Page?

Hi I am wondering if we can have block any specific dates from Jquery UI DatePicker? For Example, if we want to block all dates till tomorrow, we specify as below. $("#UsageDate").datepicker({ minDate: +1 }); Similarly, I want to block Weekends and few official days from my Holidays Schedule(For example, May 31, Nov 27th and Dec 25...

Cannot get assembly version for footer

I'm using the automatic build versioning mentioned in this question (not the selected answer but the answer that uses the [assembly: AssemblyVersion("1.0.*")] technique). I'm doing this in the footer of my Site.Master file in MVC 2. My code for doing this is as follows: <div id="footer"> <a href="emailto:[email protected]">webmaster...

Visual Studio 2010 Publish Web feature not including all DLLs

I have an ASP.NET MVC 2 application. Web project contains a reference to SomeProject SomeProject contains references to ExternalAssembly1 and ExternalAssembly2. SomeProject explicitly calls into ExternalAssembly1, but NOT ExternalAssembly2. ExternalAssembly1 calls into ExternalAssembly2 When I perform a local build everything is ...

How to bind a complex object to an ActionFilterAttribute ActionParameters?

Hello! My question is fairly simple: I have a custom ActionFilterAttribute which looks like this (simplified for readability): public class DynamicModuleActionAttribute : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext filterContext) { filterContext.ActionParameters["module"] = new MyObj...

In Asp.Net MVC 2 is there a better way to return 401 status codes without getting an auth redirect

I have a portion of my site that has a lightweight xml/json REST API. Most of my site is behind forms auth but only some of my API actions require authentication. I have a custom AuthorizeAttribute for my API that I use to check for certain permissions and when it fails it results in a 401. All is good, except since I'm using forms au...

LINQ to SQL repository - caching data

I have built my first MVC solution and used the repository pattern for retrieving/inserting/updating my database. I am now in the process of refactoring and I've noticed that a lot of (in fact all) the methods within my repository are hitting the database everytime. This seems overkill and what I'd ideally like is to do is 'cache' the m...

POST Ajax call results in not found using jqGrid and ASP.NET MVC 2 on IIS6

This is puzzling me. I deployed an MVC 2 application to IIS6 and everything works fine except for my jqGrid calls to get data. All is well on my development machine, but here are the two URLs I'm working with Local dev web server: POST http://localhost:port/Ctrl.mvc/JsonMethod IIS6 (notice https - not sure if that matters) POST ht...

What are the requirements of a collection type when model binding?

I have been reviewing model binding with collections, specifically going through this article http://weblogs.asp.net/nmarun/archive/2010/03/13/asp-net-mvc-2-model-binding-for-a-collection.aspx However, the model I would like to use in my code does not implement collections using generic lists. Instead it uses its own collection classes...

Which is more flexible in regards to database changes, EF 4 or Linq to SQL

Reading about both Linq to SQL and Entity Framework I have developed the impression that EF is more suitable for apps that get data from multiple data sources. But as I am reading about MVC2 models I see an example where EF is more loosely coupled with your data model. If I have to add or remove some columns from a table then what is i...

ASP.NET MVC Access model data in masterpage

I have created a UserSiteBaseController that gets commonly used data and sets the data to a UserSiteBaseViewData viewmodel in a method called SetViewData public T CreateViewData<T>() where T : UserSiteBaseViewData, new() { .... } I then create specific Controllers that inherit from the UserSiteBaseController as well as viewModels ...

ASP.NET MVC2 DataAnnotations Minimum length

Because I'm not using .net 4 I can't use StringLength.MinimumLength property. What is alternative? I suppose I should write regular expression: [Required] [RegularExpression("", ErrorMessage = "Minimum 3 characters")] public string Password { get; set; } Thanks, Ile ...

Business rule validation of hierarchical list of objects ASP.NET MVC

I have a list of objects that are organized in a tree using a Depth property: public class Quota { [Range(0, int.MaxValue, ErrorMessage = "Please enter an amount above zero.")] public int Amount { get; set; } public int Depth { get; set; } [Required] [RegularExpression("^[a-zA-Z]+$")] public string Origin { get...

How-to set the Description property of the ModelMetadata

I've putted a Description attribute on my property,but the Description property on the ModelMetada is null anyway. [Description("sss")] public int Id { get; set; } BTW Is I've putted corect? EDIT I've had a look at the MVC source. It doesn't seem to be a bug. The decsription attribute is just never used. There is a property in the ...

MVC2: Validate PartialView before Form Submit of Page containing Partial View

I am using asp.net mvc2 and having a basic Page that includes a Partial View within a form <% using (Html.BeginForm()) { %> <% Html.RenderAction("partialViewActionName", "Controllername"); %> <input type="submit" value="Weiter" /> <% } %> When I submit the form, the httpPost Action of my Page is called, and AFTER that the httpPos...

Adding a link tag to a masterpage with mvc 2.

foreach (var item in ((ModelBase)Model).Stylesheets) { %> <%=item.url %> <link rel="stylesheet" type="text/css" href="<%= Url.Content(item.url)%>" /> <% } I've got the code above running but whenever it outputs the link tag I get the following. ../../Content/Site.css<link rel="stylesheet" type="text/css" href="Views/Shared/%3C%25=...

Can Response.Redirect work in a private void MVC 2 Function?

I have a private void function set for some validation. Should my validation fail, I would like to redirect to another ActionResult and kill the process for the ActionResult that was being used. Response.Redirect("controllerName") does not help. Any ideas? [Accept(HttpVerbs.Post)] public ActionResult NerdDinner(string Name) { test...