asp.net-mvc

Use .ascx to render content from ajax call.

Assume I have on a page an article with the possibility to comment it. I have a submit form that submits via ajax and the OnComplete javascript method intercepts the result of the form submit. Each comment is smth like: <div class="text"> <p class="details"> User <a href="http://www.mywebsitehere.com/user/3583/" rel="nofollow" class="f...

Why do none of my ActionFilters run?

I asked a question earlier today about ActionFilters in ASP.Net MVC. It turned out my problem was really that my ActionFilter is not even running. Among other things I read this article, and I can't find anything he does that I don't. This is my code: // The ActionFilter itself public class TestingIfItWorksAttribute : ActionFilterAttri...

ASP.Net MVC AJAX link not working

I have this link, in an effort to implement AJAX log on, on my page: <%= Ajax.ActionLink("Log On", "LogOn", "Account", new AjaxOptions { UpdateTargetId = "lll", Confirm = "blah"}) %> There's a div with id lll nearby. When I click the link, I get the blah confirmation (just added for debugging purposes, the behavior without it ...

When would you not use a strongly-typed ASP.NET MVC view?

Assuming that an ASP.NET MVC View is going to show data, is there any scenario where you would not want to use a strongly-typed view? ...

Best practices regarding locations for ASP.NET MVC models

Are there any best practices that cover the places that ASP.NET MVC models should be defined? A new ASP.NET MVC project has a nice neat Models folder for them to go in, but in a production environment they can come from other places: Third party class libraries WCF services Is it acceptable for a strongly-typed view to use a class d...

How to tell MVC not to cache an aspx or ascx?

In webforms I would do something like this in the OnInit method, but where (and how) could I do the same type of thing using MVC? Response.Cache.SetCacheability(HttpCacheability.NoCache) ...

ASP.Net MVC Routes

Hello, I'm trying to set a simple routing system in my ASP.NET MVC C# application and it doesn't work :/ Here is my root "http://localhost/Admin/" or "http://localhost/Admin/Home.mvc/Index" I have a HomeController which manages an Index and a Start page. In the Index page, I have a list of client to select (button or whatever) and I...

How do I UnitTest a custom ActionFilter?

I've been trying to find some straightforward information on this, but I haven't been able to - either what I've found has been to vague for me to understand what's going on, or too specific for the wrong thing, for example a tutorial I found for unit testing an AuthorizeAttribute. (A third alternative is of course that I'm too dumb to r...

Ever had to deploy MVC yourself? Did you need visual studio installed at the deployment site?

I see in the system requirements for MVC 1.0, that you need to have some flavor of visual studio 2008 installed at the deployment site. Is this really necessary? http://www.microsoft.com/downloads/details.aspx?FamilyID=53289097-73ce-43bf-b6a6-35e00103cb4b&amp;displaylang=en ...

asp.net webforms vs asp.net MVC application

Possible Duplicates: What are the key differences between ASP.NET webforms and MVC ASP.NET MVC vs Webforms what is the best approach and what are the advantages or disadvantages over each other ...

What is the most user friendly ASP.NET MVC Grid View Control?

For a new project, we are evaluating the use of ASP.NET MVC and one of the requirements is that we have a very rich UI experience with inline record editing (i.e. the user clicks "edit" and the labels turn into text boxes and drop down lists and can update, delete, or cancel). We need all of the drop down lists to be populated from a da...

TDD - Want to test my Service Layer with a fake Repository, but how?

Hello, I've designed an application that uses the repository pattern, and then a separate service layer such as this: public class RegistrationService: IRegistrationService { public void Register(User user) { IRepository<User> userRepository = new UserRepository(); // add user, etc } } As you can see, I...

asp.net mvc parameter from page to a partial view.

Hello, I'm with a problem, I have a ajax link that pass a parameter, but, the page that it opens does not need that parameter. The page only load 2 partial views, one of those need that parameter passed to the page to load the data correctly, and the other just need to load a form, so, don't need that parameter. How can i acheive this? ...

set div visible fasle in get method of controller

I am using C# with MVC. I want to set the div visible true/false based on a condition from database in the Get method of Controller. Please suggest ...

asp.net mvc checkbox inconsistency

I'm using an checkbox on an ASP.NET MVC form like so: <%=Html.CheckBox("AgreeToRules", Model.AgreeToRules)%> The AgreeToRules property on the model is a boolean value. During testing, this all worked fine. However, now that we've gone live with this app, I'm seeing a relatively small but significant number of errors with the following...

how to pass an entitykey(reference) from a view to the controller

I had a working page with linq to sql and now I'm currently converting it into linq to entity My test project contain 2 tables, contact(id,name,email) and comments(id,contactid,comment) when I want to create a new comment, I put in the view in a hidden field the contactid and it was submitting with everything else on the submit button ...

C#: Access SQL view through generic RepositoryBase class?

I'm using a RepositoryBase<T> base class as the foundation for my individual repositories (e.g. UserRepository). It simplifies things like adding new entities etc. for example: public IQueryable<T> SelectAll() { return db.GetTable<T>().AsQueryable<T>(); } Now I've added a view "UserActive" in my database. Is there any way to...

ASP.Net MVC with web service as model?

Does anyone have advice or tips on using a web service as the model in an ASP.Net MVC application? I haven't seen anyone writing about doing this. I'd like to build an MVC app, but not tie it to using a specific database, nor limit the database to the single MVC app. I feel a web service (RESTful, most likely ADO.Net Data Services) is th...

Reference generic property in expression

Let's say I have two Tables, Lunch and Dinner. I know that both contain the DateTime property "Time". If I have a generic method GetTime, how could I return db.Lunch.Time when T is Lunch and db.Dinner.Time when T is Dinner? I'm trying to achieve this without testing for T individually using typeof, but rather generically. Pseudocode: ...

How can I force a hard refresh (ctrl+F5)?

We are actively developing a website using .Net and MVC and our testers are having fits trying to get the latest stuff to test. Every time we modify the style sheet or external javascript files, testers need to do a hard refresh (ctrl+F5 in IE) in order to see the latest stuff. Is it possible for me to force their browsers to get the la...