Let's say I have a model that looks like this:
public class MyModel
{
[DisplayName("Email:")]
[Required(ErrorMessage = "Email is required")]
[Email(ErrorMessage = "Email is invalid")]
public string Email { get; set; }
}
In ASP.NET MVC 2, I'd render the text box and validation like so:
<%=Html.LabelFor(x => x.Email)%>
...
I'm using the combination described on the title. If I use DataAnnotations the ErrorMessage I set is shown correctly on MVC 2 form validations. However if I switch the validation to Entlib 5, with the same ErrorMessage property set, the error message shown is a deafult one, depending on the validator, and not the one I set.
Before, work...
as SO digested my title i found
If you're going to integrate a ASP.NET WebForms CMS with ASP.NET MVC 2, you're going to have to do your integration at the API level (assuming the CMS has an API).
That raises the question - do any of projects exist where an api mapping some of the housekeeping functions of a generic CMS can be leverage...
In asp.net mvc 2 view i am trying to render something if true.
In code below i am trying to use Html.Encode(x) to render value into page but it does render nothing. What is wrong with if statement with html.encode?
Works
<%if (!ViewData.ContainsKey("DisplayQtyPrice")) {%>
<%: entry.Amount %>
<%}%>
Does not work
<%if (!ViewD...
I'm not even quite sure where to start explaining this problem. I've been working on this for about the past 10 hours without a clue as to what the root cause is. If any additional details are needed, I'd be happy to provide. I'm just guessing at what is relevant at this point.
I have an MVC2 site with routes set up by by Steve Hodgkiss...
I am having a strange caching problem and I believe it might be related to the fact that I am using a Entity Data Model as my data source.
The problem is that I can update the database directly and it doesn't reflect on the actual site until I republish the project. The data does display properly when viewing the project locally.
The o...
I am looking for the best approach to using NHibernate and MVC.net.
I have gone through http://www.codeproject.com/KB/architecture/NHibernateArchitecture.aspx
Someone has pointed to the use of Castle project Active record.
My aim is to eliminate the need for any nhibernate dependencies within my domain.
I want a quick and easy do...
Hey guys
I'm really new to both ASP.NET MVC and the MVC pattern generally.
For context, I'm currently running .NET 4.0, MVC 2.
I know that MCV 2 has a bunch of built in features for:
validation (both client and server side, through a variety of ways)
error handling (via attributes and other methods)
But what should be used to retu...
How can I read the username and password from http GET in .NET MVC controller? I am using a jQuery $.ajax call and I am passing username and password in as a setting.
Is this secure?
If my server is ASP.NET MVC 2 how can I retrieve the username and password from the request?
My end goal is to make a secured jsonp call.
here is ho...
Hi,
does anyone know any tool for 'code generation' using MVC2?
I know that ASP .NET has 'Dynamic Site' template (I know that don't generate any code), but I searching for one that generates code using MVC2.
Thanks
...
I'm having a weird (at least to me) problem with validation using ViewModels and Html.EditorFor(T). The validation errors produced by <%: Html.ValidationSummary(false) %> lists properties which are not invalid, and do not correspond to the values in the ModelState dictionary when I view it in debug. I'm using strongly typed view models c...
We have two websites that share some business processes and UI elements. Lets focus on a contrived example: we have an apartment rental site and a boat exchange.
For instance, on our apartment rental website, we may want to let users bid to buy boats. On our boat website, we may want to let users search for apartments.
An obvious s...
Our site current uses UIP (Microsoft Application Block - no longer supported).
Given the power and benefit of MVC, I would like to know the experiences of other attempting or having succesffully attempted this?
...
What I am doing
I am building an MVC2 website with Windows Authentication using Visual Studio 2010. I want to debug the website using IIS7 and access it from a browser in a virtual machine (in order to sign in using different users with different privileges).
Problem
When I try to access my website from my virtual machine, I get the ...
How can I best use Resource files for each page when doing localization in asp.net mvc2? Is there a naming convention or approach where the framework will automatically detect the correct resources and pull in those values?
Background: I have separate resources working for the entire site, but I would like to be able to split them by pa...
Hello,
Inside a jquery dialog I would like to use the jquery autocomplete feature of jqueryUI.
I have then prepared an action in my Controller (I am using ASP.NET MVC2) that is as follow
public ActionResult GetForos(string startsWith, int pageSize)
{
// get records from underlying store
int totalCount = 0;
string whereClau...
When running my web app on my local machine i can ref css/scripts/images using:
<link href="/Content/Site.css" rel="stylesheet" type="text/css" />
But when I deployed to my Development server, it wasn't able to find any of my content. After researching the issue everyone suggests using the below method:
<link href="<%=Url.Content("~/...
I'm trying to add a search box to a master page in an ASP.Net MVC web app. What's confusing me is how to properly implement it in the master page. So the user types in data into this search box, how should the data be handled from an MVC perspective?? I know I could use he master page's code behind, but I shouldn't. I'm currently try...
I have an override OnException(ExceptionContext filterContext) in my base controller to catch the app during any errors, and then log them. The problem I'm getting in my app is this particular method is fired off four times for certain errors. I'll walk you through a scenario:
Let's say i navigate to:
http://localhost:180/someController...
I'm trying to make my content CMS more user friendly by listing content in the following fashion:
Parent
- Sub Page
- - Sub Page
- - - Sub Page
- - - - etc...
Using .NET/MVC2, where would this function be defined and how would it be called.
This is my page listing my content:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Sh...