I am using DA 4.0 with a MVC application and have created a custom validator as shown below:
public static ValidationResult NumberOfItems(int numItems, ValidationContext pValidationContext)
{
if (numItems == 1)
{
//Tag as critical error
//return new ValidationResult...
}
...
In my blog engine, I have one controller action that displays blog content, and in that view, I call Html.RenderAction(...) to render the "CreateComment" form. When a user posts a comment, the post is handled by the comment controller (not the blog controller).
If the comment data is valid, I simply return a Redirect back to the blog...
If you have an Order that references a customer, does the model include the ID of the customer or a copy of the customer object like a value object (thinking DDD)?
I would like to do ths:
public class Order {
public int ID {get;set;}
public Customer customer {get;set;}
...
}
right now I do this:
public class Order {
...
Say I have a class that wraps the Controller class:
public class MyController : Controller
{
public string SomeProperty {get;set;}
public override void OnActionExecuting(...)
{
SomeProperty = "hello";
}
}
Now in my site.master, I want to have access to the SomeProperty that I just set.
How can I do this?
...
Hey Everyone,
I'm trying to get my company to move to ASP.NET MVC and away from classic ASP. I've written some sample applications as proof-of-concept but now I'm running into problems as I try to deploy these mvc applications to my company's IIS7 server.
My System Administrator says that there is something in ASP.NET MVC that is prev...
Ok...
I am currently upgrading a project from asp.net 3.5 using asp.net mvc 2.0.
Im having a number of issues regarding namespace conflicts and other such lovely stuff.
I was hoping someone could shed some light on a few things...
The system.web.routing 4.0 and system.web.abstractions 4.0 libraries are empty, what's the motivation h...
Hi.
Using a 'portable' web server in aspnetserve (http://code.google.com/p/aspnetserve/) to host .NET web apps locally on a machine.
I've been having speed issues, it would seem.
Debugging with VS (their default webserver for such) runs much quicker with no issues.
Having issues to the point of seeing javascript fail to load with as...
I'm not sure if this behavior is expected or not, but it seems that custom model binding doesn't work when the binding is assigned to an interface type. Has anyone experimented with this?
public interface ISomeModel {}
public class SomeModel : ISomeModel {}
public class MvcApplication : HttpApplication {
protected void Application_...
I've been working through my first MVC application, and I'd like to localize it. I know how to use the App_GlobalResources but I'd prefer to use the App_LocalResources.
In a typical WebForms application, you put the App_LocalResources folder in the same directory as the ASPX file... is this the same in MVC (IE: do I put them in the res...
I am using forms authentication in my ASP.NET MVC application. I want to the signup page from the authorization process. I know I can add a location tag in my main web.config file or create a new web.config inside the specific folder. But I just to exclude one specific action in the User controller. How do I do it?
...
My team doing a project related to network using Asp.net MVC(c#).
I need to validate mac address & ipaddress in client side(using javascript) & server side(using c#) for a simple form entry. I didn't get a good solution for validating mac address & ip addresss.
I searched google for finding a good user interface for validating mac add...
Hi all
I'm quite a proficient ASP.Net Web Forms developer, but I would like to get some exposure to MVC to see what it's like and if there are benefits to using it.
Is it worth using MVC for a hobby project, my main concerns are:
It may hinder development times of the website
I may not appreciate any rewards for using MVC (i.e. testa...
I am using autocomplete functionality found at http://www.devbridge.com/projects/autocomplete/jquery/. In addition to the text in the autocompelete text box, i would like to pass additional information, like selected states and highways. Following is the code I have. I am getting the text value in the textbox in the MVC action, but not t...
I'm looking for a good way to add arbitrary properties to the objects in a strongly typed list, based on the principle that I shouldn't pass a DataTable from my business layer to my presentation layer.
For example, I might have a Category class with the properties CategoryId and Title. On one page I would like to fetch a list of all ca...
Hi,
I have a table in an ASP.NET MVC2 form. On each row in the table there is a checkbox.
Underneath the table there is a submitbutton.
I want to make the button disabled when NONE of the checkboxes are selected.
<% using Html.BeginForm(....) { %>
<table>
<% foreach (var item in Model) { %>
<tr> <td>
<input type="checkbox" nam...
I've began working with asp.net mvc very recently and I've ran into a problem.
I've got an aspx page which renders a few ascx pages. What I'd like to do is declare a global var at the aspx page so it is visible to all its childs. I tried <% var i = 0; %> but it wasn't visible at the child pages.
What could I do?
...
Hi,
We have a model with properties decorated with [Required] which works great for validation. However, what we'd like to do is mark those required fields in the view with an asterisk (or some other style) to denote they are required before the user enters any data for validation.
I don't seem to be able to find anything built into t...
I'm looking to make a really simple route in my ASP.NET MVC 2.0 website. I've been googling for help but all the examples I can find are for really complex routing.
Basically I want all the pages in my Home Controller to resolve after the domain as opposed to /Home/
For example I want http://www.MyWebsite.com/Home/LandingPage/
To bec...
I am following Scott Gu's tutorial on ASP.NET MVC 2 model validation:
http://weblogs.asp.net/scottgu/archive/2010/01/15/asp-net-mvc-2-model-validation.aspx
I am using Linq To SQL so tried the buddy class technique. This works fine when using a Create scenerio as in Scott's tutorial. But when used with an edit scenerio I am getting an er...
Hello,
I try to make a view in ASP.NEt mvc 2 with a selectList.
I fill up the selectlist languages from my model (regDom)
listLangModel is a list of languages I retrieve from the database.
regDom.Languages = from l in listLangModel
select new SelectListItem
{
Text = l.Na...