asp.net-mvc

F# Asp.Net CodeDom ProviderOptions Issue

I'm creating an ASP.NET MVC application using F# on IIS 7. When I attempt to run it from the browser, I'm met with a YSOD containing the following: [ArgumentNullException: Value cannot be null. Parameter name: dictionary] System.Collections.Generic.Dictionary2..ctor(IDictionary2 dictionary, IEqualityComparer`1 comparer) +127...

Simplest method to create an asp.net mvc dropdownlist with values from 0 to 10?

Hi, I'm new to asp.net mvc, so excuse me if my question is too simple. I just want a dropdownlist that goes from 0 to 10 using Html.DropDownList. What is the fastest way? At the moment i only see the solution creating a IEnumerable of SelectListItem, add 10 values and pass it through with the viewdata, but i think that's overkill, how t...

ASP.NET MVC - Error wish to use a property of a control model

I have this error when wanting to use the property "ListaDimensiones" in a controlled and do not understand why. namespace Mkt.Web.Controllers.Cubo { // // ViewModel Classes public class DimensionesViewModel { // Variables Properties IList<Dimension> _listaDimensiones = new List<Dimension>(); //...

Does ASP.NET MVC swallow submit values?

I have a single form in ASP.NET MVC (v1) that has 2 input buttons. Each submit button has to be contained within this single form and I need to know which one the user pressed. I know about the trick to check the FormCollection values which will be returned based on the button pressed. For example, if I have and and the user clicks Bu...

ASP.NET MVC route returning 404 without action

I am working on a very simple application, using MVC2 Preview 1. I have a controller named ContentController. My problem is that /Content/Index works correctly, but /Content/ returns a 404. I am running the application on the Studio Development Server. Tested with RouteDebugger but /Content/ returns a 404, and does not display any debu...

Using asp.net mvc model binders generically

I have a hierarchy of classes that all derive from a base type and the base type also implements an interface. What I'm wanting to do is have one controller to handle the management of the entire hierarchy (as the actions exposed via the controller is identical). That being said, I want to have the views have the type specific fields on ...

Asp.net MVC UpdateModel() Prefix Without Magic String?

Is there any way to have a strongly typed UpdateModel(myEntity, MagicStringPrefix) without the magic string? So I have a view model looking like public class FooViewModel { public Foo Foo { get; set; } ... } And in my controller I have [AcceptVerbs(HttpVerbs.Post)] public ActionResult Edit(int id, FormCollection collection) ...

Object Graph / Persistence Question

I'm currently working with an online application that requires multiple screens/steps in order to complete. The application domain is modeled using an object graph. Persistence to and from a database is done using an ORM package. As I progress through the screens I build up the object graph. Between screens I serialize/deserialize the o...

"An attempt has been made to Attach or Add an entity that is not new, perhaps having been loaded from another DataContext. This is not supported."

Hi, All When I run following code: public ActionResult Complete() { try { VeriTabanDataContext db = new VeriTabanDataContext(); db.Persons.InsertOnSubmit(_person); db.SubmitChanges(); return View(_person); } catch (E...

How to get the css with in inline styles using jquery

I am loading the styles dynamically from the database in my asp.net mvc (C#) application. I am trying to change some of the properties like (background, font color, font size,...) of the loaded inline style. I am using jquery.rule to do this. I need to update the complete inline style including the changes, back to the database using j...

ASP MVC Foreign key Submit problem

I have two tables Users and Expenses in the backend. UserId is a foreignKey for the Expenses table. I need to pass the UserId from the Usercontroller to the ExpenseController to save expense info against the user id. But there are two problems. I am unable to use the id parameter that is passed to the expense controller Another is for ...

How do I redirect to a not-authorized page instead of the login page when the user is already logged in?

How do I set my Authorize(Roles="blah") token to redirect to a "You're not authorized to do this" when a user is already logged in but isn't in the correct role? Currently it redirects to the login page which isn't what we're after. We feel that it's confusing for the user to be redirected to this page as they're already logged in. In...

How to keep user data across multipage page asp.net mvc

For example, i have current user logged in and i want to have his info posted in a sidebar like name, dob on every page so how should i do this, and ofcourse the best way posible to do this? im using linq THank you very much ...

Determine the number of Linq-To-Sql queries used in processing an ASP.NET MVC URL?

I'm using Linq To Sql now, and how can I know how many queries was used to show the current page? thank you very much ...

Can a single asp.net user make more than one request at a time if the Session is in use?

I am not able to make more than one request at a time in asp.net while the session is active. Why does this limitation exist? Is there a way to work around it? This issue can be demonstrated with a WebForms app with just 3 simple aspx pages (although the limitation still applies in asp.net mvc). Create an asp.net 3.5 web application. ...

Embedding C# code using <%= code %> within javascript <script> tags

Hi All, I'm using ASP.NET MVC and would like to get Model information for use within my javascript. I've strongly typed the view, and thus am able to use <%= Model.Name %> within my HTML to get Model data. But once I'm in the <script> tags, I get no intellisense (in Visual Studio) when using <%, and the information doesn't seem to be r...

Setting up user permissions for reading and writing document files in IIS7

Hi I want to make a very simple CMS for my sites. So what I am thinking is this a user logs in and a list of their pages shows up. Now they change their ends and save it. My C# code would then write over the file/section. So I don't think it would be to bad to do this however I am not sure about how it works with read and write premis...

What's the best way to create a paging gridview-style partial view in Asp.net MVC?

In the current MVC project I'm working on, I need to be able to create something exactly like the GridView from asp.net webforms. I'm actually using FubuMVC, but I can adapt any Asp.net MVC solution to the Fubu framework. I want to create something that has the same kind of functionality as the GridView. To explain further, I mean I w...

IOC with multiple databases that use same interface (StructureMap or any other DI Framework)

We've been experimenting with StructureMap, and I'm having trouble grasping how to handle situations where a single interface has multiple implementations. The code below shows an example where we have two databases that are both accessible from a single service. public class SomeController : Controller { private ISomeService _servi...

jQuery ajax post not calling method in my controller

I have a list of tasks that I allow a user to sort, currently I am working on the dragging/dropping from one container to the other. While the dragging/dropping works, I can't get the jQuery post to fire. Not sure what's going on here. Here is what I am currently working with for my jQuery: <script type="text/javascript"> $(func...