asp.net-mvc

Strong Name Keys on Windows 7

Hi Attempting to use http://code.google.com/p/moq/ in VS2010 running Administrator on a Win7 virtual machine. I'm getting an ArgumentException: Unable to obtain public key for StrongNameKeyPair Have changed permissions here to be Full Control for Everyone C:\Users\dave\AppData\Roaming\Microsoft\Crypto\RSA I can't get any projects t...

Is ASP.NET MVC so much different than its predecessor ASP.NET Webforms?

I'm asking this question in order to decide what should I read first - Beginning ASP.NET by Wrox or Pro ASP.NET MVC Framework by Apress? ASP.NET MVC is my end goal. -- Will I miss out much if I skip the entire book dedicated mainly to Webforms? -- Do ASP.NET MVC books cover the general ASP.NET basics or do authors assume you have pr...

ASP.NET MVC: Filtering/Varying by HTTP Status Code in OutputCache Attribute

In the ASP.NET MVC site that I'm writing, I'm building a generic Error Action that is routed to by an HttpModule, following this tutorial. In this Action, I will return a View corresponding to the status code that is applied to the response inside the HttpModule (after doing this, the module transfers the request over to the Action in qu...

MVC add child to parent

Hi, assuming I have a Child and Parent object each of which has a repository and a controller. Update: A Parent has many Child objects. the parent's controller for creating would look something like. the post to create will be made using the auto-generated form. public ActionResult Create() { return View(); } ...

localize default model validation in mvc 2

[Required] [DisplayName("my date")] public DateTime? DateReg { get; set; } so if the user is going to pass in an invalid datetime value he will get this message "The value '02.07.201022' is not valid for my date." how can I translate/localize this message ? ...

Good website/Blog on spring.net...

I am new to spring.net and i would like to go through Good website/Blog on spring.net.. Any suggestion.. ...

Convert ASP.NET Webforms url to MVC route

I'm replacing an old ASP.NET webforms app with a new MVC application. However, I have an issue with users having old links to a particular page that I would like to automatically translate to the correct MVC route. Old site: http://mysite.com/ticketsdetail.aspx?id=12345 New site: http://mysite.com/tickets/details/12345 Is there a way...

ASP.Net MVC 2.0 Client-Side Validation Posting Back

Hi All I have been trying this based on Scott Gu's blog: http://weblogs.asp.net/scottgu/archive/2010/01/15/asp-net-mvc-2-model-validation.aspx My problem is that although my scripts are running (checked in firebug) and I don't get any errors. My page is still going to the server. I have javascript enabled too ;) I have the following...

Generate columnheaders based on the DisplayName attribute?

When I generate a view from the List template I notice that the names of the columns are not based on the DisplayName() annotation. I know how to edit the list.tt code template but I have no idea how to retrieve the DisplayName attributes from the class properties. ...

Setting image markup to a div is not loading the image

I am using Visual studio 2008 in Windows 7. After an ajax call, I am building an image markup dynamically and setting it to a div like this. var imageLocation="<%= Url.Action("Show", "Images", new { Id = Model.LoginUser.UserId })%>"; var markup = '<img class="profile-Image" src="' + imageLocation + '"/>'; $('.divImgdisplay').html(mark...

asp.net mvc dataannotation spacing issue

this is my group annotation attributes [RegularExpression(@"^[a-zA-Z0-9 _]*$", ErrorMessage = "Cannot Contains other characters ")] public string vcr_GroupName { get; set; } i want to allow only two spaces in my textbox in regular expression ,how would i do that ...

How do I deploy an ASP.NET MVC web site using Visual Web Developer 2010 Express Edition?

Hey there StackOverflow, I'm having problems deploying my website to the live server using VWD 2010 Express. I had done this without a problem in VWD 2008 Express. But, it seems that the tools for publishing a site are very different from 2008 to 2010. What I've tried so far is to go to Project>Package/Publish Settings and I change ...

Setting HTTP Status in ASP.NET MVC controller results does not render view.

I have a custom ActionResult for returning certain HTTP Errors, like NotFoundResult and ForbiddenResult, they all derive from ViewResult. I use them for instances like short circuiting actions with a 404 if an entity was not found in the database during the course of an action. Within these result objects, I set the HTTP Status to the ...

I get this error that I don't understand why, using NoRM and Mongo in my MVC project

Cannot access a disposed object. Object name: 'System.Net.Sockets.TcpClient'. I don't understand why it happen and how to deal with it. I use Ninject, my application is based on mvcstarter.codeplex.com/ what I do is delete some user or pages from my database and it happen for no reason(that I can find). Any help would be appreciated! ...

Create object attributes on the fly from a name/value pair catalogue?

I have this DB Table of 'Settings' that's like: MopedID, Name, Value I want to make an object in my Base Controller that is populated with attributes from whatever is stored there. So if it's: 32, "EnableHyperCanon", "True" The object at run time when I access it from any Controllers that inherit from the Base will have access to Mo...

Is there any way to get Intellisense working in Visual Studio / MVC without the "if(false)" hack?

Other than the "if(false)" hack, is there any way to get Intellisense working in VS 2010 / MVC when using the server-side Url.Content() method for re-basing Javascript files? Master Page: <script src="<%=Url.Content("~/Scripts/jquery-1.4.2.js") %>" type="text/javascript"></script> I know about the if(false) hack but I was hoping ther...

how do you specifiy how many items are shown (height) in a listbox

I have this and it shows all of the items in the listbox but there are alot of them <label for=”Application”>Application:</label> <%= Html.ListBox("SelectedCategories", Model.Applications)%> is there a way to show just show 5 items and add a scrollbar (compared to increasing the height of the listbox) ...

How to hide a content place holder in a .aspx page?

My master page has 3 content place holders: 1. left side bar 2. middle content area 3. right side bar So it looks like: <div id="left"></div> <div id="content"></div> <div id="right"></div> On a particular view page (.aspx) that inherits the master page, I want to now show #3 (right side bar). So I don't want the to be rendered...

How do you interrupt/intercept MVC Actions using ActionFilters?

Feel free to close this one if it s a duplicate. I couldn't find an answer. I wish to be able to place a System.Web.ActionFilterAttribute on an Action Method and override the OnActionExecuting method to insert business logic which determines if the Action should be fulfilled. Can the ActionExecutingContext be used to cancel the execut...

Generating entity class files from table schema

I am using LINQ to SQL with C#. Is there a method through which we can generate entity class files from the table schema? By dragging tables onto the graphical designer classes are generated but they are not the real class files(i mean actual files with the extension cs). I am aware of that we can code the class files first and then cr...