The Gu provides an example of how you might create a custom validator that overrides RegularExpressionAttribute (http://weblogs.asp.net/scottgu/archive/2010/01/15/asp-net-mvc-2-model-validation.aspx).
The advantage of this is that you don't have to create a custom Model Validator (http://haacked.com/archive/2009/11/19/aspnetmvc2-custom-...
I need to get in an action method the values from the selected checkboxes on a form
how would you do that ? (or probably get them all and see who was selected)
public ActionResult (int[] ids)
...
<input type="checkbox" value = "1" />
<input type="checkbox" value = "2" />
<input type="checkbox" value = "3" />
<input type="checkbox" v...
I have a Message table and a User table. Both are in separate databases. There is a userID in the Message table that is used to join to the User table to find things like userName.
How can I create this in LINQ to SQL? I can't seem to do a cross database join.
Should I create a View in the database and use that instead? Will that work?...
Hi,
i call a controller action in a unit test.
ViewResult result = c.Index(null,null) as ViewResult;
I cast the result to a ViewResult, because that is what i'm returning in the controller:
return View(model);
But how can i access this model variable in my unit test?
...
this is the master page :
<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title><asp:ContentPlaceHolder ID="TitleContent" runa...
I'm used to creating the UI, BLL, DAL by hand (some times I've used LINQ-to-SQL or SubSonic for the DAL). I've done several small projects using MVC since its release.
On these projects I've still continued to write a BLL and DAL by hand and then incorporate those into the MVC's models/controllers. I'm looking to optimize my time on pr...
How can I get the controller action (method) and controller type that will be called, given the System.Web.Routing.RouteData?
My scenario is this - I want to be able to do perform certain actions (or not) in the OnActionExecuting method for an action.
However, I will often want to know not the current action, but the "root" action bein...
How open pages in Main Content Place Holder? I am using ASP.NET MVC2.
...
I have run into a problem which have searched and tried everything i can to find a solution but to no avail. I am using the same repository and context throughout the process
I have a booking entity and a userExtension Entity
Below is my image
i then get my form collection back from my page and create a new booking
public ActionRe...
I am trying to write a simple regex to match a percentage value range 1%-100%
Is there a better way to write this?
^([1-9]|[1-9][0-9]|100)%$
...
I'm creating a ASP MVC application. And because of the complex authorization i'm trying to build my own login system. (So i'm not using asp membership providers, and related classes).
Now i'm able to create new accounts in the database with hashed passwords.
But how do i keep track that a user is logged in.
Is generating a long random...
Hi, I'm trying to build up a proper routing scheme for my products section in MVC 2. I've got the following criteria:
Links of the format
/Products/(MX[0-9]+) and /Products/(BDL[0-9A-Z_])
Need to route to ProductsController.Show(Id = $1)
Links of the format
/Products/([a-zA-Z0-9/]+)
Example: http://www.mysite.com/Products/Cameras/D...
I've been using ASP.NET MVC 1 for a while now, and am keen to take advantage of the improvements in MVC 2. Things like validation seem greatly improved, and strongly-typed HTML helper methods look great.
So, for those of you who have real-world practical experience of using ASP.NET MVC 1 and are now using MVC 2, what are your top 5 rea...
I have a working controller for another stored procedure in the database, but I am trying to test another.
When I request the URL;
http://host.com/Map?minLat=0&maxLat=50&minLng=0&maxLng=50
I get the following error message, which is understandable but I can't seem to find out why it occurs;
Procedure or function...
I have a network folder that is mapped to my iis app as a virtual directory and I'm trying to do some authentication for files that are located there with an ihttpmodule. I've verified that the ihttpmodule is firing properly for anything else in my app, just not the files located in virtual directory. Most of what I've found is that th...
Hi all,
I have a ASP MVC web application that uses a plugin to load images and points for a 3d application.
When debugging with the the Visual Studio development server the images and the points are served up great...
http://i148.photobucket.com/albums/s19/littleniv/Debugging/local.png
Second image: same url but iis.png
When running...
I'm in the process of moving a large classic ASP application to ASP.NET MVC 2. Questions:
My question is about project organization.
I would prefer to not mix the MVC code with the ASP code in the same VS project. I'd like to have an MVC WAP with areas that match the parts of the website that I'm migrating. For instance, the old site ...
Hello, I have a dictionary I'm passing to a View. I want to be able to pass the values of that dictionary back to a Controller action from this same View. Is there anyway this can be accomplished without using a form? The situation is that I need to be able to pass these back to a controller action that is called when a user clicks an...
Hi.
This is a modification to a question I've asked before on this forum.
My controller action:
public ActionResult SearchResults(string searchTerm, int page)...
My view:
<%= Html.PageLinks((int)ViewData["CurrentPage"], (int)ViewData["TotalPages"], i => Url.Action("SearchResults", new { page = i }))%>...
The route entries:
routes...
I want to tie in to MVC to trigger some code to run whenever the View is finished processing but not yet finished sending data to the browser.
...