I have a controller called MetricsController with a single action method:
public class MetricsController
{
public ActionResult GetMetrics(int id, string period)
{
return View("Metrics");
}
}
I want to route calls to this controller like this:
http://mysite/metrics/getmetrics/123/24h
I've mapped an additional route in my Gl...
Today I started playing with the MVC 3 Beta. Started with an application from default MVC 3 template, added a new action in the Home controller as follows(with a view for it)
[Authorize]
public ActionResult Secured()
{
ViewModel.Message = "This is secured area, only authenticated users should be here.";
return View();
}
Now wh...
I have something like this:
I am using Ajax.BeginForm and its updatetargetid is a div which basically informs user whether it was successfully submitted or not and the problem, if any.
My controller function that is handling the form submission checks if there were any errors like duplicate entries and such and does re-checking of clie...
Ok, I've been going at this for several hours and I simply cannot find the solution.
I want to get some data from my user. So first, I use a controller to create a view which receives a Model:
public ViewResult CreateArticle()
{
Article newArticle = new Article();
ImagesUploadModel dataFromUser = new ImagesUploadModel(newArticl...
How can line 25 in the code below generate the error that follows? I'm baffled. ProductSuggestions is IEnumerable<Product> ProductSuggestions
Line 24: <%if (Model.ProductSuggestions != null) { %>
Line 25: <%if (Model.ProductSuggestions.Any()) {
Object reference not set to an instance of an object.
Description: An unhandled exc...
My website uses linq-to-sql to load about 50k rows of data from a database. This data is static and never changes. It works similar to a spam filter and all 50k rows of patterns need to be loaded.
What's the best way to program this? for optimal performance?
...
I'm using the approach mentioned in the last part of Steve Sanderson's post to dynamically add/remove items in a collection using Ajax:
http://blog.stevensanderson.com/2010/01/28/editing-a-variable-length-list-aspnet-mvc-2-style/
Does anyone know a way to get this approach working so that it degrades nicely when JS is disabled?
If my m...
Hi Guys,
Here's the scenario:
ASP.NET MVC2 Web Application
Entity Framework 4 (Pure POCO's, Custom Data Context)
Repository Pattern
Unit of Work Pattern
Dependency Injection
Service Layer mediating Controller -> Repository
So basically, all the cool stuff. :)
Flow of events for a basic UI operation ("Adding a Post"):
Controller c...
I'm building an ASP.NET MVC site where I want to use OpenSTV to conduct polls. To run results through OpenSTV, I'd have to run the executable. Is that allowed from a medium-trust ASP.NET application?
...
I am following the tutorial of scott gu from Here to retrieve the data using stored procedure. i am setting the return type of the stored procedure by dropping the SProc on class. Now my question is that can we set some viewmodel as the return type of the stored procedure, as my view is strongly typed with my viewmodel
...
Hi,
I wish to lock out access to html page (eg. /manual/manual_A/index.html)
if a certain condition is not met (eg. HttpContext.Current.Request.Form["key"].toString().Equals("a") ), I wish redirect to specific view (eg. /errorPage/) else continue (eg. /index).
In register Route I add:
routes.MapRoute(
"ErrorPage", ...
Is it true that asp.net MVC doesn't use SESSIONS [Sessions varibale] and hence there it's performance is better than asp.net webform.
if this is not the case then why the speed of asp.net MVC is faster than asp.net webform?
...
I am trying to understand the ASP.NET WebForms and MVC from the point of view of understanding the design patterns used.
While MVC clearly looks like an implementation of FrontController, I am not very sure about WebForms pages. So, I would appreciate if anyone can help with the following questions around this.
Is WebForms based on a ...
Hello!
How can I generate action link with custom html inside.
Like following:
<a href="http://blah-blah/.....">
<span class="icon"/>
New customer
</a>
...
Hi
I'm not sure if this is the best approach so hoping for some advice. I have a pager that updates the page using ajax. I'd like the user to be able to select the size of the page they require I'm doing this with a form and some jquery which calls an action method that sets the Session["PageSize"] value which is used to determine how ...
Ive got projects and devices which are linked to each other in a many-to-many relation. On creation of a project the user gets a list of available devices to link to the project using checkboxes. The controller code for create is shown below.
I am using ASP MVC with ActiveRecord.
public ActionResult Create()
{
ViewData["devices...
By default Master pages in .NET MVC2 placed like this /folderlevel1/folderlevel2/Site.master accessed from the url domain.com/urllevel1/urllevel2/ will resolve the URL in this tag:
<link href="/Content/Site.css" rel="stylesheet" type="text/css" />
to
<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
This beco...
Hello,
Each time I deploy my application either on my laptop (Vista) or on my desktop(XP), I'm getting the following error: "HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory". After doing some researches, I'm advised to enable "Directory Browsing". But, instead of getting the applicat...
Is it possible to build a DNN module that uses ASP.NET MVC?
Granted that DNN doesn't support ASP.NET MVC out of the box...but since both DNN and MVC run on top of the ASP.NET pipeline...
The reason I ask. Large legacy website running on DNN:
http://blahblahblah.com
I'd like to stick an existing ASP.NET MVC webpage/application here:
...
Using ASP MVC with active record.
Ive got 2 tables with records that sometimes are related and sometimes aren't. The relation is defined by the user. 1 table has projects, the other has devices. Projects can be created and deleted, devices cannot. When a user deletes a project, all relations between that project and the devices should b...