asp.net-mvc

ASP.Net MVC, strongly typed view with DateTime not accepted?

Hi all, I wish to create a view like <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<System.DateTime?>" %> but I get an error saying that DateTime must be a reference type in order to use for parameter TModel. Fair enough, but I google plenty of examples that implement just what I try to achieve. Any clues as to ...

ASP.NET MVC IoC usability

Hello everybody, How often do you use IoC for controllers/DAL in real projects? IoC allows to abstract application from concrete implementation with additional layer of interfaces that should be implemented. But how often concrete implementation changes? Should we really have to do job twice adding method to interface then the impleme...

Can I use breakpoints (as while debugging) while 'unit testing' ?

Hello, I'm walking through the FrontStore series tutorial on TDD in MVC (Part 3 by Rob Conery/ASP.NET). The test I'm concerned with is the CatalogRepository_Each_Category_Contains_5_Products(). Until I get to that test, everything was working fine. Now, I've gone through every line that makes this test (including the test itself, the Te...

NVP request - CreateRecurringPaymentsProfile

Im facing problem with Trail period and first month payemnt. My requirement is users can signup with trial period which allow new users to have a 30 day free trial. This means they will not be charged the monthly price until after the first 30 days the regular amount will be charged to user. but the next billing date should be one mon...

How to render the properties of the view model's base class first when using ViewData.ModelMetadata.Properties for a generic edit view

When I use the ViewData.ModelMetadata.Properties in order to loop the properties (with an additional Where(modelMetadata => modelMetadata.ShowForEdit && !ViewData.TemplateInfo.Visited(modelMetadata))), and thereby create a generic edit view, the properties of the view model's base class are rendered last. Is it possible to use a clever ...

Is there any good ASP.Net MVC project with TDD & MOQ Source code available?

hi guys, i'm starting to learn TDD, Unit-testing on asp.net mvc and i'm trying to pickup all these mocking via MOQ. so i'm looking for any good asp.net mvc projects which source codes are made available to mere mortals like me :) i've found some good asp.net mvc source codes but not those that uses MOQ specifically. the asp.net mvc s...

ASP.NET MVC security: how to check if a controller method is allowed to execute under current user's perrmissions

Given an ASP.NET MVC Controller class declaration: public class ItemController : Controller { public ActionResult Index() { // ... } public ActionResult Details() { // ... } [Authorize(Roles="Admin, Editor")] public ActionResult Edit() { // ... } [Authorize(Roles="Admi...

ASP.NET MVC Filters: How to set Viewdata for Dropdown based on action parameter

Hi, Im loading an entity 'Member' from its id in route data. [ListItemsForMembershipType(true)] public ActionResult Edit(Member someMember) {...} The attribute on the action loads the membership type list items for a dropdown box and sticks it in viewdata. This is fine for add forms, and search forms (it gets all active items) but I ...

FormsAuthentication.SignOut() on server

FormsAuthentication.SignOut(), in so far as I understand it, just kills the cookie in your browser. Ie if cookie to save and after FormsAuthentication.SignOut () use again, the user is authenticated. How to kill a session on the server? Ie make any cookie does not valid? I have ASP.NET MVC. HttpContext.Session.Abandon() does not work. ...

What is the scope of ViewData Dictionary?

What is the scope of ViewData Dictionary?I mean when It Creates for a View & when it destroys? Lifecycle of ViewDataDictionary. ...

ASPMVC, $.getJSON, very slow

This is my first game with JSON and I am surprised how slow it is. I am quite sure I am missing something and I'll be gratefull if someone can help. Here is my code $.getJSON('/localhost/CountryList', function (data) { alert ("finished"); }); My countryList returns an array like this {"Code":"AF","Name":"Afghanistan"}, {"Code":"...

GetAllUsers - MVC

I’m using the Membership Provider and would like to display a list of all the users and their First Name, Last Name etc using the GetAllUsers function. I'm having trouble understanding how to implement this function in MVC. Has anyone implemented this in MVC or is there an easier way to list all the users in my application? Any help o...

Running ASP.NET MVC in a subdomain makes Html.ActionLink render broken links

I am running MVC in a subdomain http://test.domain.com which points to the /Test directory on my webhost4life account. Html.ActionLink("About", "About", "Home") it renders a link to http://test.domain.com/Test/Home/About -- which gives a 404 the link should be .. http://test.domain.com/Home/About is there a way to override A...

How to get Auto-completion in ASP.NET MVC?

Hello, In ASP.NET MVC, we don't have controls which can do stuffs such as autocompletion (we don't have controls at all from Visual Studio like in web forms). But, Is it possible to still get 'Auto-completion' with a text box in ASP.NET MVC (like with the textbox found on the Google's Home page)? If this is the case, what's the best ...

How do I set the base model from a basecontroller in asp.net mvc

Hey Guys I've got a BaseController that all of my site's controllers inherit from. I've got a BaseModel that all of my Models inherit from. I want to set my BaseModel in my BaseController's OnActionExecuting method and make it available to the specific model in the specific controller. Is something like that possible? Mustafa ...

ASP.NET MVC Concurrency with RowVersion in Edit Action

I'm wanting to do a simple edit form for our Issue Tracking app. For simplicity, the HttpGet Edit action looks something like this: // Issues/Edit/12 public ActionResult Edit(int id) { var thisIssue = edmx.Issues.First(i => i.IssueID == id); return View(thisIssue); } and then the HttpPost action looks ...

The HTTP verb POST used to access path '/Documents/TestNote/Documents/AddNote' is not allowed.

I am having two user control on a aspx page and one of the user control has a text area for notes. and i am trying to use JSON so that when they click the addnote button it does not reload the page. Below is my java script , but it says that it is giving this error The HTTP verb POST used to access path '/Documents/TestNote/Documents/...

Unit testing with Data Access Layer

Hi, what is a good way to write unit tests with a LINQ to SQL DAL? Currently I am doing some database testing and need to create helper methods that access the database, but I don't want those methods in my main repo's. So what I have is two copies of the DAL, one in my main project and one in the Test project. Is it easier to manage ...

How to pass Model from a view to a partial view?

Hi I have a view that is not strongly typed. However I have in this view a partial view that is strongly typed. How do I do I pass the model to this strongly typed view? I tried something like public ActionResult Test() { MyData = new Data(); MyData.One = 1; return View("Test",MyData...

Asp.net MVC/Silverlight and Sharepoint 2010 integration

Just a sidenote: I'm not sure whether I should post this to serverfault as well, because some MOSS admin may have some info for me as well? Additional note 1: I've found this document (Asp.net MVC 2 & Sharepoint integration) if anybody with sufficient expirience is willing to comment on its content whether this can be used in my ...