Here's a simplification of my real models in ASP.NET MVC, that I think will help focus in on the problem:
Let's say I have these two domain objects:
public class ObjectA
{
public ObjectB ObjectB;
}
public class ObjectB
{
}
I also have a view that will allow me to create a new ObjectA and that includes selecting one ObjectB from ...
I have such a form
<form name="" method="post" action="Save" enctype="multipart/form-data">
<div id="dialog" title="Upload files">
<input type="file" id="Image" name="fileUpload" size="23"/>
</div>
<input type="submit" value="Create" />
</form>
how sould i get the get the images bytes in ...
I must be missing something, when trying to define a HABTM association with 2 of my models. I have a "Product" table, and a "Category" table, and a "ProductsCategories" join table. In SQL Server, I am defining the Relationship between the tables on the join table. However, when I create the LINQ to SQL model "Product," I get "Product....
It looks like there's an issue in MVC 2 RC1 if you want to use jQuery.Validate but not the main Microsoft AJAX - which is 25kb even when gzipped.
According to Phil Haack you're supposed to be able to just include these scripts:
<script src="/Scripts/jquery-1.3.2.js" type="text/javascript"></script>
<script src="/Scripts/jquery.va...
Hello, I want to use Html.DropDownList(string name, IEnumerable SelectList, Object htmlAttributes) to render a select list with a preselected value for me.
My select list is in the model object of my view, so I have been writting the following code:
<%= Html.DropDownList("aName", mySelectList, new { }) %>
Which will render the select...
I'm working on a messaging system for a site of mine written in ASP.NET MVC. Right now, I'm attempting to iron out Pagination for the Inbox/Sent views.
I've stumbled onto Rob Connery's PagedList<T>, which seems like a nice solution to the problem.
However, one difference between my use-case and Rob's however is that I don't return IQu...
I'm trying to use updatemodel(myItem, formcollection) with asp.net mvc 2 but it fails with the stack trace below.
at System.Web.Mvc.FormCollection.GetValue(String name)
at System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
at System.Web.Mvc.Controller.TryUpdateMo...
I'm getting this error:
ex = {"The binary operator Equal is not defined for the types 'MySite.Domain.DomainModel.EntityFramework.NickName' and 'System.Int32'."}
What I tried to do was do a select all where the NickNameId = someIntPassedIn... the problem is that the NickNameId is a foreign key, so when it compares the someIntPassedI...
My ASP MVC Web project runs and debugs without any issues in VS2008SP1 (.NET 3.5 SP1). However when I run the Azure project that refers to the same Web project as a Web Role, although it runs without issues, I can't go back to Visual Studio when I'm done.
It seems as if VS is waiting for a modal form to close (I get the "bing" sound in...
In my MVC application I have a problem with passing data from view to controller. I have fairly complex domain classes:
public class TaskBase : PersistableObject
{
public virtual TaskCategory Category { get; set; }
public virtual IList<TaskNote> Notes { get; set; }
public virtual string TaskTitle { get; set; }
public vir...
Background
I'm learning the ropes around how to use ASP.NET MVC properly, and ran into this issue with models:
I have a model that describes a contact I can get that out of the form for creating a new contact, but say when we edit a form, I retrieve it from the repository, show the fields on the contact form and then get the contact ob...
How do I set it so that when a link is clicked in a view, it prompts the user to download a file.
...
Is there any way to centralize enforcement that every action method must have a "ValidateAntiForgeryToken" attribute? I'm thinking it would have to be done by extending one the "routing" classes.
Edit: Or maybe do some reflection at application startup?
...
Until I started building MVC sites, I always built WebForm web sites using Visual Studio Web Site projects (instead of Web Application projects). When I publish my MVC sites, I'm loving the Publish Web dialog that allows much more control over the deployment than I'm used to. This is the feature I've been looking for for 5 years! Web ...
I've implemented my own Authorize attribute, and I notice that it queries to check permissions when I use [Authorize].
Is there any way I can get that permission and use it in the current controller that applies the Authorize attribute without having to rewrite and requery the code in the controller?
...
ViewModel is a term that is used in both MVVM (Model-View-ViewModel) and the recommended implementation for ASP.NET MVC. Researching "ViewModel" can be confusing given that each pattern uses the same term.
What are the main differences between the MVC ViewModel and MVVM ViewModel? For example, I believe the MVVM ViewModel is more rich...
What are some common errors that programmers face in ASP.NET MVC when compiling or running their application?
Example
The incoming request does not match any route
Please include the solution with the error, or if there isn't one set solution, what developers should look for when encountering these errors.
...
I have a mvc viewpage where I have detailed form for users to fill. In the form there are 2-3 dropdowns. On selection of option in those dropdown the page is posted back. Now during these postbacks i want to maintain the vertical scroll position for the page. To achieve this I used
Page Language="C#" MasterPageFile="~/Views/Shared/Site....
I have a project that I have recently started working on seriously but had a bit of a design discussion with a friend and I think he raised some interesting points.
The project is designed to be highly scalable and easy to maintain the business objects completely independently. Ease of scalability has forced some of the design decisions...
I currently have a collection of routes like
{controller}/{action}/{from}/{to}/{some}/{other}/{things}
{controller}/{action}/{from}/{to}/{some}/{other}
{controller}/{action}/{from}/{to}
{controller}/{action}
and views with forms with get actions to retrieve the results. But the get actions go to the
default/last route with the parame...