Is it possible to map a route with MapRoute and specify a generic controller e.g
context.MapRoute(
"Dashboard_Edit", // Route name
"dashboard/edit/{*pagePath}",
new { controller = "Dashboard`1", action = "edit", pagePath = "home" }
);
...
Given an action like:
public ActionResult DoStuff([CustomAttribute("foo")]string value) {
// ...
}
Is there any way to resolve the instance of value's CustomAttribute within a ModelBinder? I was looking at the MVC sources and chances are I'm just doing it wrong, but when I tried to replicate their code which retrieves the BindAttrib...
I would like to use DataAnnotations in my ASP.NET MVC application. I have strongly typed resources class and would like to define in my view models:
[DisplayName(CTRes.UserName)]
string Username;
CTRes is my resource, automatically generated class. Above definition is not allowed. Are there any other solutions?
...
basically, im calling Html.TextAreaFor to display a form, which is great/not a problem...
people enter text in it, and it gets submitted, and if it is successful, i want to return an empty Html.TextAreaFor... but after it's submitted, in the action method i am clear to set the Comment that people are making in the TextArea to an empty s...
hi there
I am using editor and display templates on my MVC project with MetaData
I use something Called UIHint that enables me to show a particular control
for example all my description fields require a textarea that is using tinyMCE
however i want the name of the textarea to match the name of my field:
i.e i have Model Employee, wi...
hiya
when using EditorFor(model => model.FieldName)
i want to have a generic say datepicker, rich text editor, upload box etc
but with editorFor you cant pass a value, so you have to create a strongley typed element for
each model that requires one of the above.
anyone know if you can pass a generic model or a generic value like usin...
i have this:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<string>" %>
<script src="<%=Url.Content("~/Scripts/ckeditor/ckeditor.js")%>" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
var CurrName = $(".ckeditor").attr("name");
CKEDITOR.replace(CurrN...
I'm having a problem with an ASP.NET MVC application that I'm developing. I'm still fairly new at web development and in particular MVC, so please forgive me is this is a really stupid newbie mistake ;-)
I have a view that displays a list of products. Each product has a 'details' link that I want to link to a details view for that produ...
The page I'm building depends heavily on AJAX. Basically, there is just one "page" and every data transfer is handled via AJAX. Since overoptimistic caching on the browser side leads to strange problems (data not reloaded), I have to perform all requests (also reads) using POST - that forces a reload.
Now I want to prevent the page agai...
I have a Asp.net MVC web application, containing mostly text. I want to put a feature into it so that admin can easily edit text/html using the web. May be some double clicking on a page and converting it into editable and save able. How can i do it? any sample code?
I need this to be done for Asp.net MVC.
...
There are already jQuery based Edit in place plug ins available. But i am not sure how can i use them with Asp.net MVC. Any code sample for controller? I want to edit the .aspx files as my web application is not getting text/content from database...
...
I am posting a form to url /Admin/EditInPlace from page /About
In EditInPlace's conroller code i can find the Url-Referrer i.e. from which page request is coming. But how can i map the Url-Referrer to its View page??
In short how can i found that a page /xyz is mapping to which View.aspx file programmatically?
...
First of all, it needs to create some codes that handle any error in my application like the following code.
public class HandleSomeErrorAttribute : HandleErrorAttribute
{
public string ControllerName { get; set; }
public string ActionName { get; set; }
public override void OnException(ExceptionContext filterContext)
{
...
I've just updated to VS2010 (rc) and subsequently been forced to update my projects and convert to MVC2 (ta microsoft)... which has scuppered the first app its touched.
Error 2 'System.Web.Mvc.IValueProvider' does not contain a definition for
'Where' and no extension method 'Where' accepting a first argument of type
'System.Web.Mvc...
For my Contact class, the property EmailAddress is marked with the [DataType(DataType.EmailAddress)] attribute.
In my view, using Html.Display("EmailAddress") and Html.DisplayFor(c => c.EmailAddress) yields different results. The former outputs a mailto: link, which is the expected behavior, while the latter simply outputs the email add...
I am building an asp.net mvc web site which needs to host some JMOL content.
JMOL is an open-source Java viewer for chemical structures in 3D.
http://jmol.sourceforge.net/
The problem is that when I host the JMOL files which have been created for this site on IIS, I get errors when JMOL attempts to load the .pdb files.
e.g. java.io.I...
This code works:
[HttpPost]
public ActionResult Edit(int id, FormCollection fc)
{
Movie movie =
(
from m in _ctx.Movie.Include("MovieActors")
where m.MovieID == id select m
).First();
MovieActorViewModel movieActor = new MovieActorViewModel(movie);
if (TryUpdateModel(movieActor))
...
I just installed VS 2010 RC and now my MVC 2 project created in VS 2010 Beta 2 won't load stating:
'The project type is not supported by this installation.'
Sweet! What the hell do I do now? Anyone else having this issue?
...
I'd like to supplement my existing DotNetNuke website with a side application which is built on MVC.
To do this, I'd like to set the MVC application up on a separate subdomain (e.g. subapp.mydomain.com) and to connect to the same database.
I've tried this already and I can get the MVC app to connect at the ASP membership levels (just u...
In a custom ActionFilter, I want check the attributes on the controller action that will be executed. Running through a small test application, the following works when launching the app in the asp.net development server-
public class CustomActionFilterAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(Action...