I have a controller method:
public ActionResult Details(int id)
{
Order order = OrderFacade.Instance.Load(id);
return View(order);
}
that is used for 95% of possible invocations. For the other 5% i need to manipulate the value of id before passing to the facade. I'd like to create a separate method within this same c...
Hi
I have server caching error on ASP.NET MVC Pages.
The scenario is like this.
I have two applications (1).External Website and (2).Internal Adminsite, both pointing to the same Database.
There is one page called EditProfile Page on the External Website that registered customer can update his profile information like Firstname, Lastn...
I want to do something like this
$.get('/Controller/Action/', { model : null }, function(data) {});
Unfortunatelly it doesn't work. In server side the value of the model is {object}.
How do I get null?
EDIT
--- Javascript ---
var json = JSON.stringify({ model: null });
$.get('/Controller/Action/', json, function (data) { });
-...
I have a control in ASP.NET MVC that spits out JavaScript in the page header (in the view page). I derive some values from the current view name (including its case). Let's say we are talking about the path: /Home/Index - my control spits out JavaScript to call a function with the view name - in its exact case - e.g. someFunction('Index'...
I have a form in which I have many checkboxes. I need to post the data to the controller upon any checkbox checked or unchecked, i.e a click on a checbox must post to the controller, and there is no submit button. What will be the bet method in this case? I have though of Ajax.BeginForm and have the codes below. The problem im having...
I've seen a few examples of people using this syntax for HTML.BeginForm:
(Html.BeginForm<Type>(action => action.ActionName(id)))
But when I try this syntax all I get is a:
The non-generic method System.Web.Mvc.Html.FormExtensions.BeginForm(System.Web.Mvc.HtmlHelper)'
cannot be used with type arguments
What am I missing?
Visual Stud...
Hi. When and where would you create database to develop web site using ASP.NET MVC 2 and Entity Framework 4 (CreateDatabase method). I think about first run of web site and redirect on welcome page, when controller creates database from model. But I doubt about details:
1. Where? In HttpModule, but request of any image or css will check ...
Howdy, I have what should be a simple question. I have a set of validations that use System.CompontentModel.DataAnnotations . I have some validations that are specific to certain view models, so I'm comfortable with having the validation code in the same file as my models (as in the default AccountModels.cs file that ships with MVC2). ...
Hi
I have a web application that fetches a lot of content via ajax. For example when a user edits some data, the browser will send the changes using an ajax post and then do an ajax get to get fresh content and replace an existing div on the page with that content. This was working just find with MVC1, but in MVC2 I would get inconsist...
I am working with ASP.net MVC 2 framework, for multiple sites. We have a base site and then sub sites that inherit from a "Core" site that contains 90% of the functionality that the sub sites will use.
In one of the controllers, I am saving some data, adding a UI message to the tempData and then using Response.Redirect.
The redirect w...
Hi
I have an ASP.NET MVC page(Registration). On loading the page, i am calling Jquery Dialog with Agree and Disagree buttons on that Dialog.
1). How to set the focus to Agree button by default?
2). How to disable the X (Close) Mark that is on Top right corner? (So that i don't want the user to close that dialog simply).
Code:
$("#di...
[HttpGet]
public ActionResult LogIn(string username)
{
if (username == null)
return View("404");
return View();
}
Inside the view a want to get the view file name. In this case the action value is always LogIn. But the actual view is or LogIn of 404. I have a master page that need to know th...
I need to create a custom route to list all the rooms in a given building. So, I want the url to look something like this:
/Building/1000/Room
Which would list all the rooms in Building 1000.
Is this the correct mapping for the route (to call the IndexByBuilding method in RoomController)?
routes.MapRoute(
"RoomsBy...
There seems to be an issue around generating IDs with indexers within the MVC Framework (as detailed here http://aspnet.codeplex.com/WorkItem/View.aspx?WorkItemId=5495).
To fix this, I've downloaded the source, modified it and tried using it - but due to the lack of snk file for signing in the source download, everything I try is result...
I´ve tried a couple of different ways to deploy a application to a IIS 7.5 running on my machine for testing purposes and i´ve sort of hit a wall. Nothing works out of the box. Everything assumes I have knowledge I don't have and would prefer not to have to aqquire.
Google isn't really helping either with answers ranging from "copy file...
I am playing with MVC2 in VS 2010 and am really getting to like it. In a sandbox application that I've started from scratch, my database is represented in an ADO.NET entity data model and have done much of the validation for fields in my data model using Scott Guthrie's "buddy class" approach which has worked very well.
However, in a u...
I am making a number of distinct controllers, one relating to each stored procedure in a database. These are only used to read data and making them available in JSON format for javascripts.
My code so far looks like this, and I'm wondering if I have missed any opportunities to re-use code, maybe make some help classes. I have way too l...
I'm having some difficulty understanding how to validate a date (DOB) using MVC2. What I want to do is 1. Is the date entered a valid date and, 2. Is the date at lease 13 years in the past. For example, to validate an email I use the following code:
[Required(ErrorMessage = "Email address is required.")]
[StringLength(320, ErrorMess...
I'm having the "Microsoft JScript runtime error: Object doesn't support this property or method" error when calling the datepicker function on a textbox generated from my data model.
in the head section I have:
<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery-1.4.1.min.js" type="...
I have a form on my web page, it allows to submit many queries to my website,
every query is on a separate line in TextArea. Because waiting for all queries to complete is
too long I would like to update the web page after every query completes - send result of one query to a web browser, new result should be appended to old results tha...