// Not thread-safe
class ShoppingCart {
private List<Product> products;
public void Add(Product p) { products.Add(p); }
public void Remove(Product p) { products.Remove(p); }
}
Whenever user triggers an action associated with shopping cart, we pull it out and do what is needed.
// Could be a HTTP GET or AJAX pull
Add(Produ...
I have created a variable length list according to the many great posts by Steve Sanderson on how to do this in MVC 2. His blog has a lot of great tutorials.
I then created a custom "requiredif" conditional validator following this overview http://blogs.msdn.com/b/simonince/archive/2010/06/11/adding-client-side-script-to-an-mvc-conditio...
Improving urls
Currently I have links in the form (displaying product information):
http://localhost:XXXX/Products/?page=1
I want to clean this up into the form:
http://localhost:XXXX/Products/Page1
I think I need to do this with routes.MapRoute, something like so:
routes.MapRoute(null, "/Products/Page{page}", new {controller = "P...
I would like to pass more than one parameter to the partial view. With the following
<% Html.RenderPartial("Details", Model.test, new ViewDataDictionary { { "labelName", "Values1" }, {"header", "Header1"}, {"header2", "Header2"}}); %>
code, I am having error message
) missing.
What is wrong?
<%@ Control Language="C#" In...
Hello,
Im starting with MVC2 and i have a simple question:
If i have a typed view with a form inside, and this textbox created with lambda expressions:
<%: Html.TextBoxFor(e => e.Name)%>
When i submit this form the default model binder take the request form, takes the model typed to the view, serialize the data posted (as a this m...
I have been using jQuery for the past couple of years now, and I'm comfortable with it. In every MVC project that I start, the first thing I do is delete the MicrosoftAjax files from the solution. I'm wondering now if there's any value in them though? What can I do with them that I can't easily do with jQuery? Also, why do Microsoft incl...
I am using a checkboxlist helper and dynamically binding it..Now i want to maintain the state of checkboxes?
public ActionResult Step3()
{
CustomerQuestion _Cust = new CustomerQuestion();
//Retrieve the answer from database by siteid
var Questions = QAService.GetAllAnswer(1);
var ...
Hi
I have created these functions which I described in the question. However I think the way I did it is not the optimal way of doing it.
[HttpPost]
public ActionResult Create(FormCollection collection, string schooljaarparam, FlatONASAanbieder foa) {
if (ModelState.IsValid) {
// var r = new List<V...
Hi,
I am building a simple CMS with asp.net MVC and I have almost all the parts working. I have one minor issue which I can't work out how to solve. I have a Html helper method that renders the content of area. This method however uses the Response.Write to write its content rather than returning a string. The reason for this is that I'...
I'm running an Asp.NET MVC 2 app under IIS 6.
All pages are behind Windows Integrated Authentication except for some pages that accepts anonymous access.
We setup these pages in the web.config with the location element like this
<location path="MyPath/ToThePage">
<system.web>
<authorization>
<allow users="*"/>
</...
So I am adding StaticTextField controls to a page. This is using ExtJS, but we use VB.NET methods to add ExtJS so we don't actually have to write it.
I tried using
.Style = "text-align:right"
But that isn't working, in fact it isn't doing anything. Here is the whole code of one of the controls:
With .AddColumns(2)
Wi...
Hi,
Before down-voting or closing for duplicate questions, I want to make clear that I have read old posts on this site and others. The problem is that they are old (some at least) and are not giving really good examples.
I currently use ASP.Net MVC 2.0 with Ajax.BeginForm and jQuery Validation client-side validation which both works p...
Hello all.
My story is: I have a couple of forms in separately views that post description info to edit. And every description belongs to different places. So I'm sending also refTypeId info in my forms to decide which description belongs where. So far ok. but I want to return back to edit description view where form was sent from afte...
Hello all,
I know that there are a variety of similarly posed questions here on SO and I've had a look at the ones that are suggested as matches. However, none quite manage to solve the issue that I'm facing. Basically, I'd like to know if there's a way to 'subscribe' to an event at client level in order to have a small portion of the p...
We are migrating a project from classic Asp.Net web forms to Asp.Net MVC.
I have followed the fours steps outlined here
http://www.codeproject.com/KB/aspnet/webformmvcharmony.aspx
and all is working well.
Now I want to get Visual Studio to include MVC item templates in the "add new item" dialog. So I add {F85E285D-A4E0-4152-9332-AB1...
Hi,
I am trying to demonstrate a web site scenario on my own.
What i want to do is a multimonth calendar which can be filled with special days with a css class.
I googled it and find some Js calander controls with customizable css.But i wanted to ask it first before i start coding and probably be wasting my time.
Kind regards,
Barbaro...
I have a wizard in my asp.net MVC application which is built upon this SoG - RESTFUL wizard guide.
In order to understand the problem I will first explain the situation below. For this I will use a dummy situation, we try to create a person with an address. Again, this is just a dummy situation!
The situation
At start, the object (pe...
I am looking for examples of configuration based validation using Validation Application Block. I've found this
I want to ask if someone has an alternative solution to using EL VAB 5.0 to achieve configuration based validation. I've started with DataAnnotations but soon found out that some properties will need different types of validat...
So I'm rendering a partial view in memory in order to direct the XSL-FO data in the view to a PDF renderer.
The PDF renderer can take a string, XmlDocument or Stream as input.
Here is what I'd like to do: (Edited for clarity)
Solution taken from: http://thriftybliss.spaces.live.com/blog/cns!58DA805F37F31F20!170.entry?wa=wsignin1.0&...
I've been working through a fantastic book (Pro ASP.net MVC 2 Framework, Steven Sanderson) and I am looking for clarification. In the book's e-commerce sample application uses linqTOsql and has just one table to hold product entries. Obviously, real world applications have many many tables. I am wondering if there is a separate reposit...