asp.net-mvc

How do I prevent an action method being called directly?

I'm developing a wizard type solution in MVC2 and I'd like to prevent users from going to step 2 directly, however, I'd still like it to show up in the URL. Also, because progress can be saved at any time, I'd still like the ability to programmatically go to Step2. How can I do this? [HttpGet] public ActionResult Step1() { ...

ASP.NET MVC Unit Test With Cassini

Has anyone got experience using the cassini web server to host their asp.net mvc application for testing? Borrowing some code from Testing ASP.NET Web Applicatins (Ben Hall,Jeff McWerther) I thought I had it working. However, mvc routing is totally ignored. This means I can request static files - asp.net web forms pages. But I cannot r...

Is it possible to deploy asp.net mvc project on IIS server without installing of mvc?

Is it possible to deploy asp.net mvc project on IIS server without installing of mvc? ...

Advice on creating a MVC Helper for the jquery UI accordian

I want to create a mvc helper method for the jquery UI accordian widget. Any advice on how I should design it for re-usability? ...

Why do I need 'Classic Mode' in ASP.NET MVC in IIS7?

Why do I need 'Classic Mode' in ASP.NET MVC in IIS7? Integrated Mode provides more features and better performance, so why do I need Classic Mode? Perhaps I dont understand the differences, please can someone explain? ...

Inject ASP.NET MVC Controller property into service layer dependency?

I am using an approach similar to the one in this ASP.NET MVC tutorial where you pass a wrapper around a controller's ModelState collection into a validation class so that the controller can access error information. Here is a cooked up example: interface IProductValidator { void Validate(Product item); } class ProductValidator { ...

I have just inserted a item of data. Now I want my view to clear, but it doesn't.

I use my View to added a record in a database table. After I click submit, I want the screen to clear ready for my next insert. So within my controller I send a new ViewModel with the default values for both my HttpGet and HttpPost. However I am finding that once I have inserted a record, all the old values remain after my HttpPost. What...

How do I toggle the display for a dynamic id table?

I have a table that displays rows based on a drop down list option. The rows are dynamically created. I use the value on the ddl for the initial row, then a simple counter to make it unique. Is there a way to say something like show all the rows that start with "tableShoes" even though the rows are something like tableShoes1, tableShoe...

Updates to Controllers or Models are not accounted for when recompiling ASP.NET MVC application

This is more of a VS.NET issue I'm sure, but I can't get this to work. I am updating an older ASP.NET MVC application. I update code in a class (eg: Controller or Model). When I rebuild the project/solution and test it (localhost) the changes to the code are not compiled, these changes are not applied. However, changes to the Views t...

MVC HandleError vs customErrors tag

So if I understand [HandleError] correctly (see here) you have to add it to each Controller that you want to have errors handled on. It seems much easier to just add the path of your error page into the web.config customErrors tag: <customErrors mode="On" defaultRedirect="~/Error/Index" > </customErrors> In what situations would usi...

Why does LINQ to SQL think think that my new object is null when I try to add it to the database?

I am trying to add a record to my database table using LINQ to SQL and ASP.NET MVC 2. The snippet in my controller that populates the LINQ object is this: /* other code removed */ if (ModelState.IsValid) { var stream = new Genesis.Domain.Entities.Stream(); // Handle stream // Is this...

Populating MVC view model from validation class in separate project.

Here is my situation. My solution structure is as follows. Project Used to handle routes, displaying data, ... Project.Core Used to handle business logic, validation, querying, ... In Project.Core I have a validation class that validates my DTO (Data Transfer Object). My validation class (in Project.Core): public class IncidentValid...

Grouping not working with ajaxically loaded telerik MVC Grid

Hi, i m using telerik extensions for .net mvc. in grid everything is working fine until i try to group the grid control based on some columns. actually my grid is not server bound (even it loads the grid from a partial view using ajax). in this grid grouping causes problems and i get javascript error at a[this.plugins[e]].initialize(this...

ASP.MVC 3 Installation error.

I'm installing ASP.NET MVC 3 Beta and this thing comes out : This product requires Microsoft ASP.NET Web Pages 1.0. Please install the missing component, then try to install this product again. What the hell? I'm using MVC 2 just fine. Should I go and install asp web pages 1.0 and where do I get if from ? ...

What is the aspx/ascx view page equivalent of #include Someplace.Models?

In my Controllers I obviously #include namespaces so I don't have to write out the entire thing when making objects. What is the way to do this inside the aspx/ascx View files? Currently I am having to write out these entire namespaces and it's getting pretty lame. ...

Export iQueryable of complex objects to Excel

We have some code that exports data from a database to Excel and it works well. The main problem is we use a DB view to gather all our data. This creates the issue of having a sizable view as we have multiple types of objects of which we export. class Event int id string title List<EventDate> Dates string desc class EventDate...

MVC routes / url, jQuery and Virtual Dirs

Im with my first web app and this is my first deploy. All is working on local, but is not in remote. I used the web deploy option of VS2010. First: <link href="../../Content/Site.css" rel="stylesheet" type="text/css" /> <script src="../../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script> The app knows that Site.css can ...

Advice on ASP.NET MVC to Java migration?

I'm an ASP.NET developer trying to learn Java web dev. I would like to migrate a small ASP.NET MVC site to Java. I have the ASP.NET code and the SQL Server database. I'm comfortable with Netbeans and Eclipse. I know the basics of servlets and JSPs. I'm wondering whether it would make sense to use a web framework instead of using JSP/...

Is there a secret to using LINQ to SQL to add records when the object has relationships?

I am working in LINQ to SQL, ASP.NET MVC, and C#. I have a repository called genesisRepository to connect to the database. I have a table represented in an object called Stream. It is defined like this: [Table] public class Stream { [HiddenInput(DisplayValue = false)] [Column(IsPrimaryKey = true, IsDbGenerated = true, AutoSync...

ASP.NET sending email through exchange problem

I have an exchange 2010 server running on Windows 2008 R2, I also have a remote webserver running Windows 2003 with multiple sites on it (all asp.net mvc 2 sites). I setup a Transport in exchange and all the websites on my remote web server can send email no problem to anyone in the exchange server and to any external domain. Now for my...