asp.net-mvc

ASP .NET MVC Freezes Visual Studio during new Project Creation

I'm using VS 2008 with SP1, on WinXP Pro, and I successfully installed the MVC package from Microsoft. I start a new project, select the MVC web project type, and give it a name and folder. When I press go it hangs forever. The "ProjectName" folder is created, but nothing else is there. I can create and open all my other projects with...

in ASP.Net MVC, what is the most elegant way to access objects stored in the session?

In my asp.net mvc project I store two objects in the session when the user logs in. One is a User object (representing the logged in user) and the other is the Organisation object (representing the user's organisation). I need one or both of these objects to be available in every action method. What's the most elegant way of dealing wit...

Flash Media Server calling a page that returns JSON data

I am very new to Flash development. I have an asp.net mvc site that has a controller action that returns JSON. I have a Flash Media Server setup that needs to call that controller action every 15 minutes to get the current schedule. I can get the FMS to call the site (and every 15 minutes no problem) and I am getting the JSON right now...

How to add a custom column to a MvcContrib Grid ?

I don't find a method to add a custom column in a MvcContrib Grid. With the old version you could do : column.For("Edit").Do(p => { %> <td> <a href="/People/Edit/<%= p.Id %>">Edit</a> </td> %>}); But with the latest version, the Do() method disappears... So now which method use ? ...

A potentially dangerous Request.Form value was detected from the client - ASP.NET MVC

I am getting this error in my ASP.NET MVC application where I am taking HTML input from a WYSIWYG so I don't want the content validated. I have attempted the solution I found here but it seems to make no difference in my MVC application. I have also tried doing it in the web.config but again - no joy. Is this a bug in ASP.NET MVC or som...

NHibernate: "failed to lazily initialize...", DDD approach

Hello, I'm trying to set up NHibernate in an ASP.NET MVC application using a DDD approach. However, I do get an error when trying to lazy load an objects related entity. Heres how I've structured my application: Infrastructure layer: Contains mapping files, repository implementations and a NHibernate bootstrapper to configure and build...

How do I turn off validation on Html.DropDownList() when using an option label?

I am passing a optionLabel into the Html.DropDownList helper (taken from this SO question): <%=Html.DropDownList("PO.Vendor.VendorId", this.Model.Vendors, "-- add a new vendor --")%> That produces markup with an option of value 0 with the text "-- add a new vendor --", which is exactly what I want. However, if that option is selected...

Drawbacks of PHP-on-IIS?

I work in a dev environment that is currently IIS6/Server 2003 with Framework 3.5. I primarily am working in ASP.NET MVC. I've run into a scenario where, for the solution I'm working on, I'd either have to spend weeks reinventing the wheel or integrating a PHP-based opensource project into one of the components I'm building. I'd love ...

SelectList, ASP.NET MVC

I'm working with a SelectList, and populating it with the data from a table. I'm trying to bind it to the ID of another object. EDIT Updated the Schema to Reflect something I neglected. I have updated it to show the exact names of each item. I think the problem comes in the fact that each Unit has a sheet, and each sheet has a product....

ASP.NET MVC actionlinks injecting current variables into them?

currently I have a medium sized MVC project with multiple controllers that support paging through a paging helper. this works like this routes.MapRoute( "TabletsPaged", "Tablet/Page/{page}", new { controller = "Tablet", action = "Index" } ); //paging in the tablet controller ...

Route constraint to be either "car" or "boat

Hi, I have a route where I want to set a constraint on the "action" paramter. It has to be either "Car" or "Boat" ...

From an Architecture stand point, What is a best approach Session[] or Encrypted Cookies?

We are trying to decide the best decision to maintain state across our web application. We are incline to use Encrypted cookies on the browser, but some of our developers think we should go with Session variables on the server. The main reasons why I think Cookies are a best approach is just because we will not depend on the app serv...

In ASP.NET MVC how do you allow a controller to be accessed anonymously (without login)?

I am working in this MVC app made by others, every page requires you to login first. How do I set one of my controllers to work without having to be logged in? At first I thought this was due to the master page but when I removed the master page it still redirects to login when they first browse to the controller action. Is this set in t...

CheckBOX ASP MVC

Hi i am new to ASP.NET MVC. I am not sure how to deal with Check box or Radio Button to get values when they are clicked. Can any one help me? I am providing a simple code that might help you understand what i meant to be. Please share examples. <script type="text/javascript" > function check(browser) { document.get...

ASP.NET MVC Controllers properly initialized when testing

How do I get an ASP.NET MVC controller properly initialized for an integration test? My current problem is that when I try to access the User member of a controller I get: System.NotImplementedException: The method or operation is not implemented. What I want is what Ruby on Rails provides out of the box with the Functional Tests....

string manipulation(ASP.NET MVC)

i have here a code that gets a portion of a record on my database and display it and has a link ("Read More") that renders the viewer to the detailed page of that record.. <% Dim id As Integer = _news.Rows(count).Item("IDnews")%> <%=_news.Rows(count).Item("newsTitle")%> <img src='<%= Url.Content("~/NewsPictures/" + _news.Ro...

JsonResult Problem

I have an ActionResult returning this : return new JsonResult() { Data = new { isDeleted = isEntityDeleted } }; in javascript , the value returned by that ActionResult is "{"isDeleted":true}" , which is an object called data, but if i try to access data.isDeleted i get undifined What am i doing wrong? Edit: javascript code:- $.p...

MvcContrib GridModel : Is it possible to do ActionSyntax in a GridModel

I have a code in my aspx file which uses ActionSyntax, and i want to use a GridModel instead, but i don't know how to do that. Here is a sample of my aspx file : <% Html.Grid(ViewData.Model).Columns(column => { column.For(x => x.Id).Named("N° de contrat"); column.For(x => x.SubscriptionDate).Format("{0:d}").Named("Date de souscri...

MVC alternating color for table

Hello I have a standard loop that lists a table of things. And I would like to do some sort "i % 2", but I dont know how to get that "index"-value for each row in model. <% foreach (var item in Model.Users) { %> <tr> <td><%= item.Firstname %></td> <td><%= item.Surname %></td> <td><%= item.Email %></td>...

xVal in MVC.NET with nHibernate.validator does not fire client validation

I have an ASP.NET MVC Project working with NHibernate and NHibernate.Validator and i'd like to use xVal 1.0 (most recent release). I Added the requested scripts to the project and referenced it in Site.Master: <script type="text/javascript" src="<%= ResolveUrl("~/Scripts/jquery-1.3.2.js")%>"></script> <script type="text/javascri...