asp.net-mvc-2

Using CSS to Create Vertically Oriented Table

Our project needs to have a "table" with headers on the left hand side, at the beginning of each row, and then each object will be added to a column in the "table" We also are trying to keep the project AJAXy, so we need to have edit in place functionality for this grid. We're using ASP.NET MVC 2, so I've been using PartialViews to repl...

Help me give Entity Framework Navigation Properties meaningful names, not User{1,2,3,4,...}

I have inherited a medium sized database that we are trying to use with Entity Framework in a MVC2 rewrite we are working on. We used the existing database to generate the data model (.edmx file) and all was good. Until I realized that I could not use the dot notation access all the fields. appointment.Employee.name // works fine app...

Where's the DLL for SportsStore.UnitTests???

Hey there SO, I reading Steven Sanderson's book, Pro Asp.NET MVC 2 Framework. I'm on page 116 and I'm running into trouble trying to use NUnit. The book says that I should locate the DLL for SportsStore.UnitTests (one of three projects in the SportsStore solution.) But when i go to SportsStore\SportsStore.UnitTests\bin\Debug\ there is ...

Asp.net mvc 2 custom view model: where would the validation attributes go?

I've been chugging along OK with the use of data annotations made on buddy classes so far. When it comes to a more complex view that requires a custom view model--one that includes a few select lists, for example...would I need to then transfer my validation attributes to the view model class? I was planning to pass the full custom vie...

Linq to SQL using Repository Pattern: Object has no supported translation to SQL

I have been scratching my head all morning behind this but still haven't been able to figure out what might be causing this. I have a composite repository object that references two other repositories. I'm trying to instantiate a Model type in my LINQ query (see first code snippet). public class SqlCommunityRepository : ICommunityRepo...

MVCContrib Grid showing headers when empty?

The elegant Action Syntax in the MVCContrib Grid gives us the Empty() method. However, the default behavior of MvcContrib.UI.Grid.GridRenderer<T>.RenderHeader() is to hide the table column headers when the grid is empty. Is there a way to show headers when data is not present that does not require a major refactoring? Now I have heard o...

Designing for asp.net-mvc Areas

I'm about to start a new large mvc 2 project and i guess i should use areas though this is still a grey area (sic) for me. the site will have several sections such as user maintenance, project maintenance, some sort of dashboard for projects etc. in the projects are you'll be able to add tasks with attachments etc, move tasks between p...

A potentially dangerous Request.Form value was detected from the client

Hi! I'm using ASP.NET MVC2 and what I did didn'T help me to get rid of this exception. I put [ValidateInput(false)] before the conntroller, changed web.config but again getting this exception. What I should do? EDIT: I'm posting HTML values. ...

Error in ASP.NET MVC SelectList. Value Cannot be null, parameter name: items

This line is causing me some problems in an MVC app i'm developing <%= Html.DropDownListFor(model => model.TypeID, new SelectList((IEnumerable)ViewData["TaskingTypes"], "TypeID", "TypeName"))%> It causes the error in the title when two other required fields in the form are not filled in. When the fields are filled in, the form is sub...

Disk based cache using ProviderBase

Hi, Has anyone managed to create a disk based cache provider using the ProviderBase available in .NET4? ...

Telerik MVC: Generic Grid

I am wondering if I could design a generic way to design a Telerik MVC Grid. Example: Model is a List of FieldDescriptor. A FieldDescriptor has a name, a value and a type. Thus I want to show the colums of the Grid according to the data in the model - depending on which fields come and what their type is. But the Telerik MVC Grid onl...

Can't use relative paths with areas in ASP.NET MVC 2

In my application I have an area call Mobile. In this area I have a folder call Assets where we place all our css, javascript and images. Accessing the views works just fine. http://localhost/webapp/mobile/stuff The problem is when I access my css, javascript and images. I cannot do something like this in my view. <img src="Assets/c...

Operator '=' is not defined for types 'Integer' and 'IQueryable(Of Integer)'

This is giving me a headache. I have this link query here that grabs an ID Dim mclassID = From x In db.SchoolClasses Where x.VisitDateID = _visitdateID Select x.ClassID And then later on I have this linq query ViewData("Staff") = From t In db.Staffs Where t.ClassID = mclassID Select t Any help would be much appreciated. I've tried ...

JQuery validation based on class?

I have a form that will have dynamically created elements, one of those will be of date type. There can also be many fields of this type on my form, all which must be validated. I am using a strongly typed view in Asp MVC, so the name will change based on various factors. What I would like to do is validate based on a class name inste...

Updating a Model in asp.net mvc

Our project manager has asked us to refactor an app that was using the Repository Pattern (it was done using Nerddinner as example) to now use a service Layer. My problem now is that Im not sure how to Update a Model cause the UpdateModel method is supposed to be used in the controller... whats a recomended approach to updating a model u...

Custom errors override in ASP.NET MVC area

I would like to have custom error pages unique to an MVC area. Unfortunately, it appears that the Web.config override system doesn't take the MVC folder structure into account. If I want to override an area called "mobile", I have to create a root project folder (in with Views and Controllers) named "mobile" and put the Web.config in the...

How to make autocomplete posting data to the server with first char only and filter the returned result with jquery

All what I need to make any auto complete jquery plug-in to take the first char in the textbox and return all matched names for example from the server, then after writing the rest of chars I can filter the returned result by jquery not all the time posting the chars to the server and return the result. I am using a plug-in that like th...

MVC Areas and routing

I'd like to have an area called "Products", where I can use routes such as http://localhost/products/foo http://localhost/products/bar I would like to have the views and other assets organized into a folder structure like /areas/products/views/foo/index.aspx /areas/products/views/bar/index.aspx I'd like to keep images, etc...

How do I get the RouteData associated with the parent action in a partial view?

In the action for a PartialView, I'd like to know the RouteData associated with the Parent Action. This partial view is part of my masterpage template, and I'd like for it to know the Controller and Action that was called as part of the page rendering. In my PartialView's action, I inspect RouteData.Values["controller"] and RouteData.V...

FormsAuthentication and Roles problems

What is this garbage in the URL? After login I am directed to: http://localhost:1337/%28F%2883mI1fhnT6Sm1XopiPcErGYaqCafgnoSL_hgFJi9u7MwncoR98KOirf8GuqRVFfAbZN9mR1IH6W8LQQIeHTd4NcR5BKHAVvZrmcIoDTGTf01%29%29/ When I debug I see that in Global.asax as well as AccountController my userRoles/accessLevel are correctly being found and inserte...