asp.net-mvc

NHibernate: How do I XmlSerialize an ISet<T>?

Given: I'm trying to create a REST API using ASP.NET MVC. I'm using NHibernate in my data access layer. Problem: I'm can't XmlSerialize ISet properties. I get errors like the following: Cannot serialize member [namespace].[entity].[property] of type Iesi.Collections.Generic.ISet`1[[namespace].[entity], [assembly], Ver...

how to reset the name attribute of a input control after a jquery action

i have an html table inside a form in an asp.net mvc view. I am using the tablesorter jquery plugin as well. Here is the table code (simplified for the example) <table id=managersTable> <thead> <tr> <th>Manager</th><th>Remove</th> </tr> </thead> <tbody> <tr> <td>Manager 1<input type='hidden' name='updat...

ASP.NET MVC 2 - Setting values on IValueProvider

I am attempting to upgrade my MVC 1 project to MVC 2 RC. We currently have a custom modelbinder that adds items to the ValueProvider (this worked when it was a dictionary). We then passed this off to the default modelbinder. However, IValueProvider does not have an add method, so this algorithm no longer works. Does anyone know of a way ...

Nlog not working in release mode

I am using Nlog to log the exceptions in my asp.net mvc (C#) application. Nlog is not working in release mode. The same is working when running in debug mode. What may be the problem? Is there any fix for this? ...

In ASP.NET MVC, is UpdateModel recommended

In ASP.NET MVC, UpdateModel is dreadfully convenient if not a bit too black box. One of the primary reasons I use ASP.NET MVC, however, is exactly for the insane amount of control I get compared to ASP.NET so from an ideology perspective, the black box part bothers me a bit. Is the use of UpdateModel recommended? It's used in the (origi...

ASP MVC DropDownList returns 0

Hey, following my struggles with the MVC DropDownList posted here, it seems that my DropDownList always returns 0 when I submit the form. I still have the same code as the other thread. Is it because the Status and Type Tables are not linked together in the code? I really don't know where to start to look for the problem. Thanks. ...

could a controllers action be used for both a regular web request and a ajax call?

could a controllers action be used for both a regular web request and a ajax call? For a regular web request, the action would take in a forms collection, associate the category to the article and then redirect to another page. for a ajax request, it would associate the category to the article, but instead of redirecting it would send ...

Calendar Questions - Icalendar library, making a actual calendar

Hi I have some questions regarding calendars Is there any good calendar generates for either asp.net mvc or jquery. I would like to find something that can make calendars and have features like this. Generates all the months (but of course only features the current month that is being displayed) If the name of the calendar event is ...

Disposing datacontext causes Invalid attempt to call Read when reader is closed

I'm building an MVC 2 app and using linq to sql with stored procs. I created a data access layer that has an internal datacontext class and a public class that I expose applications. In my public class I expose methods which access the datacontext class and convert the data to my own object model classes using linq. In my public class...

Will linqtosql take care if many threads are accessing the same table of the database at the same time?

I am working on a asp.net mvc application. I have a situation where I have to make many threads which are going to access the database using linqtosql. My question is, will it be fine to leave every thing on linqtosql to maintain the synchronization, because the threads will be accessing the database at the same time. Or I have to write ...

ASP.NET MVC: replace <%= Html.TextBox("name") %> with <asp:TextBox>

Hello, Because i want to set a Extender (Calendar from the AJAX Controls toolkit) on a textbox, I have to change the code from <%= Html.TextBox("name") %> to <asp:TextBox ...> But how can i bind the attribute "name" on the element? Thank you ...

Value cannot be null.Parameter name: key

Hi, Value cannot be null.Parameter name: key I have started to get this error since i ve implemented the StructureMapControllerFactory as my DefaultControllerFactory. Actually i copied the code from MVC Sample App StoreFront, but i couldn't figure out why this error keeps popping up. Even this error show up the application still runs...

Can you pass a model with RedirectToAction?

I'm using mvc 2 release candidate, and am wondering if there's any way to pass a model to an action using RedirectToAction. For example, I have an edit action which takes an ID, and loads the record from a database, displays the current values in text boxes and lets the user edit and click submit: public ActionResult Edit(int ID) The...

How to have a strongly typed partial view?

Hi Say I have just a normal view(not strongly typed) and in this view I have this <% Html.RenderPartial("ViewUserControl1") %> However this Partial View is strongly typed with a class(lets call it class1). How do I pass data to this strongly typed view? Like in my partial view I can't go right now and do something like this <% Mod...

Entity Framework - joining nulls - NullReferenceException was unhandled by user code

I am writing an asp.net mvc application to learn Entity Framework with and am running into an issue that I do not know how to handle. For simplicity lets take the following table structure: Movie ID (int, not null, auto increment) Name (varchar) GenreID (int) and Genre ID (int, not null, auto increment) Name (varchar) M...

changing view mvc 2 causes problems handing post

I have a controller with the following actions: public ActionResult Create() { return View(new MyModel()); } [HttpPost] public ActionResult Create(MyModel model) { //Update database ... //Pass the current model so we don't have to load it from the database return View("Details", model); } [HttpPost] public ActionRe...

How to insert data into the right calendar cells?

Hi I have a calendar that I generate. Currently it makes the entire month and fills each cell with a number(representing the date). Now I want to grab values from a database and fill in the cells. How could I do this efficiently? Like right now I can only think of grabbing the data from the database. Once that is down going through th...

why to use asp.net mvc with TDD?

why to use asp.net mvc with TDD? ...

Entity Framework throws SqlDate exception on the *lookup* table

I am using Entity Framework with asp.net mvc, but I don't think mvc plays a big role here. I have an object Customer, and a lookup table (there are several, and they all behave the same way; so for simplicity I'll pick Territory). Both Customer and Territory have LastUpdated field (Datetime that is set manually in the code). If I hardc...

Date only from TextBoxFor()

Hello, I'm having trouble displaying the only date part of a datetime into a textbox using TextBoxFor<,>(expression, htmlAttributes). The model is based on Linq2SQL, field is a DateTime on SQL and in the Entity model. Failed : <%= Html.TextBoxFor(model => model.dtArrivalDate, String.Format("{0:dd/MM/yyyy}", Model.dtArrivalDate))%> ...