I'm creating an Asp.net MVC site using the Entity Framework and am wondering how to keep new and updated entities in memory across multiple requests without committing to the database.
Say, for example a user goes to a view for editing an entity, and on that view they can add children to the entity. I would like to not commit the change ...
I have an object that has a few different List properties that contain child objects.
I'm trying to wrap my head around the best way for the user to select and add these child objects from a New view (where I'm creating a new instance of the parent object).
As an example, suppose I have a Project class and a "New" ViewPage that present...
I have a simple test application:
Model:
public class Counter
{
public int Count { get; set; }
public Counter()
{
Count = 4;
}
}
Controller:
public class TestController : Controller
{
public ActionResult Increment(Counter counter)
{
counter.Count++;
return View(counter);
}
}
Vi...
Hello all,
I run a small e-commerce site that over the last few years has built up a reasonable search engine status.
I've been working on a new site that uses new URL formats and I am worried about how to deal with all the broken links and customer frustration for users finding out dated links through search engines.
Can anyone offer...
I am redesigning a site in ASP.NET MVC and as a consequence every page will have a new URL. I'm going to implement 301 permanent redirects from the old pages to the new. I'm wondering if doing this for thousands of pages all at once will have a negative effect on SEO. What about hundreds of thousands?
...
Should I do something along the lines of this? I'm thinking of all my controllers inheriting from BaseController. Does this break the design pattern of IoC? What else should I do instead?
public class BaseController: Controller
{
protected ICookieService CookieService {
get {
return ServiceResolver.Resolve<ICooki...
Hey all, I'm facing a really strange problem that has me smoked.
I have a fairly simple scenario where I have a strongly typed view that is correctly populated from the controller on the GET, but then when it POSTS the form to the controller, the Reqeust is full of all the right values and right key names for the default model binder ...
I followed the guidance in the Professional Asp.net 1.0 Wrox book for adding the MVC references to an exisiting web application and it works well except for the scaffolding options. When i right click a controller i do not get the scaffold view options that you get in a new asp.net mvc app. I am sure there is a .csproj hack that is neede...
I'm new to the MVC framework and have just run through the NerdDinner sample project. I'm loving this approach over form-based asp.net.
I'd like to spin of a more sizable side project using this same approach. Do you see anything in that project that would prevent me from enlarging the basic structure to a more complex website?
Exa...
I've been given the task of creating a site that will allow our various large clients to log into our website and click on our various pages to view analytics data based on their sales.
Does anyone have any idea about the best way to handle multiple databases based off the user? Lets say we have 3 big name clients, the design decision ...
I am in doubt how to construct my views and viewmodels... Lets see a (simplified) situation. I have a registration view with two variations: openid and strandard username/password. I see two ways how to
implement this:
1.) First way: one view model and one view (some kind of Pseudocode):
class RegisterViewModel:
- public string OpenI...
I have a BarEditor.ascx, that can be called from diffent places.
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<MyApp.Models.Bar>" %>
<%= Html.TextBox("a") %>
...
Now consider I need to edit two objects on one page Edit.aspx
<form action="update">
<div>
<% Html.RenderPartial("BarEditor", Vi...
My page view currently has a dropdownlist on it that is getting bound to a collection from the controller. This is working fine, However I want to insert an item to the top of the dropdownlist that is not in my collection e.g the list currently gets the following items
Open
Closed
I want to add a third option of "All" but I don't want...
Hello, using asp.net mvc, I'm initializing a list in the server code, and allowing the end-user to add to the list on the form (using JQuery to add entries). I know how to obtain a list's selected items on a post back, but I don't need to do that here. I want the complete contents of the list accessible in the server code after a post ba...
As of recent, a few of my strongly typed views randomly (w/ zero code changes) decided that 'Model' was not a valid item ... again - ZERO code changes. I simply opened my view and now it's broken ... so logically I deleted the view and created a new one - still broken. Has anyone else come across this issue using MVC? A simple example...
In asp.net mvc 1.0 it is possible to add a [ValidateInput(false)] attribute to an ActionResult. Is it possible to allow some HTML (<p>,<a>) and disallow other HTML tags (<script>)? How would I do this?
...
Imagine I have a list of objects that implement an interface called ISummary
The objects within this list MAY have additional properties ie.
public interface ISummary {
Guid Id {get;set;}
string Title {get;set;}
DateTime Created {get;set;}
}
public class GigSummary: ISummary {
Guid Id {get;set;}
string Title {get;set;}
DateTim...
I'm working on a pretty standed ASP.NET MVC application. We've got the core logic behind a set of services and we're using StructureMap to inject appropriate instances of appropriate IRepositories to abstract communications with the data layer proper. We've also got a rather exhaustive series of unit tests on these services. But, as thin...
I have a form in an MVC view which contains a number of text boxes, drop down lists and text areas. I am using the HTML helper to create these controls, including pre-populating them with View Data where appropriate, and applying styles via the htmlAttributes parameter.
This is working fine with TextBox controls and DropDownLists etc, h...
I am aware that views should not have code in them but in a project I am working on I have a lot of logic in the views.
My home page has
<% Html.RenderPartial("SearchResults"); %>
Now in the partial view I have an aweful lot of logic like this;
<div id="RestaurantsList">
<%if (Model.restaurantsList.Count() > 0)
{
foreach (var ...