Using a technique I found in one of the recent ASP.NET MVC books, I have an action method on a controller that returns a partial view for an ajax request and a full view actionresult for a normal get request -- it checks the IsAjaxRequest property of the Request object to determine which type of actionresult to return. The partial view ...
I have a DatePicker working on a View which also has a ViewModel associated with it.
When I execute the Post action back to the controller the ViewModel is instantiated again and some of the values are not available from the View.
The Controller Action is:
public ActionResult Search()
{
ProjectSearchViewModel viewModel ...
I'm in the process of adding some UI functionality to a hybrid WebForms/MVC site. In this case, I'm adding some AJAX UI features to a WebForms page (via jQuery), and the data is coming from an MVC JsonResult. Everything is working 100%, with one exception:
I would like to implement the XSRF protection of AntiForgeryToken. I have used...
This is a question of style. On date night with my wife she says that I have none and should seek advice.
In my ASP.NET MVC View I pick a sprite based on a boolean value set in the model like this:
<div class="sprite-icon_dog<% =(Model.HasNewDog ? "_new" : "") %>"></div>
This is ugly and I don't like it.
My objective is to use the s...
Is there an article somewhere explaining exactly how the route matching works, and what it is capable of?
for example, how would i write a route to catch everything?
so:
/
/something
/something/else
/something/else/again
all get mapped to the same controller action, with the url as a parameter?
{*anything}
doesnt seem to work. ca...
I have a complete validation on an obeject and am trying to figure out the best way to handle it.
Given the following class:
public class LetterResponse {
public Guid Id {get;set;}
public bool SendBlankCart {get;set;}
public string ToName {get;set;}
public string ToAddress {get;set;}
}
I want to use a dataannotation and xval in o...
I'm currently trying to user actionlink helpers in a way that I don't think was described in NerdDinner.
Lets say I am on this page
/Dinners/
and on that page there is a list of dinners, ok fine and working
now lets say I want to goto a new section of the site, which I have created a new controller MenuItemsController
so lets say I ...
If I have a HomeController displaying its Index view, how would I proceed in order to have the Index view imbed a UserControl from another Controller?
Here's a look at the content of the Home/Index View:
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<asp:Content ID="indexTitle...
No javascript/AJAX to be used.
when clicked on the hyperlink, it should open a new browser window.
...
I'm getting a View not found exception when my ASP.NET MVC site is configured with is home directory pointing to a network share in IIS.
The weird thing is that this error appears intermittently, sometimes the view loads fine and others the same view fails.
I've tested this in IIS 6 and 7, both have the same problem.
I also have other...
The default ASP.NET MVC project sets up a "Models" directory that I don't know that I've ever used in the handful of MVC projects I've worked on. Normally, I have a separate 'library' project that stores business logic classes.
Now I'm curious: Am I missing something big by not taking advantage of the default ASP.NET "Models" director...
Hello,
In my ASP.NET MVC web application, I have:
Domain Model, created by LINQ to SQL
Repositories such as
UserRepository and OrderRepository
IQueryable Fluents as IQueryable Extension Methods such as
public IQueryable<Order> GetNewOrders(this IQueryable<Order>)
Services such as
UserService and OrderService
Utility Classes and Ex...
It is quite possible that I may not have got the point, but I really can't figure out how ASP.Net MVC's HTML Helpers can help me. Here's a sample: -
HTML:
<a href="ActionName" target="_blank">Click Me</a>
HTML Helper:
<%= Html.ActionLink("Click me", "ActionName", null, new {target="blank"}) %>
My eyes are reading HTML more easily,...
Hi
how can you do multiple "group by's" in linq to sql?
Can you please show me in both linq query syntax and linq method syntax.
Thanks
Edit.
I am talking about multiple parameters say grouping by "sex" and "age".
Also I forgot to mention how would I say add up all the ages before I group them.
If i had this example how would I d...
Hi
I am wondering how does the Authorize Tag determine if the user is authorized or not?
Like say if a user logs in and they try to go to a view that has an Authorize tag. How does it determine if a user is authorized or not? Does it do a query to database and check?
How about if they go to a view with a role authorization? Does it qu...
Hi, I'm working on an MVC application and I have and admin area... So what I need is:
When user makes request to admin (for example "/Admin/Post/Add") I need to map this to controller AdminPost and action Add... is it possible?
...
I got some logic I want to execute each time a action returns a view. The logic needs to know the name of the action and the controller. At the moment I am working with a filter on each controller/action but sometimes I want all the actions that return a view to use this logic. So adding filters everywhere seems like extra work I can avo...
so i have a "Parents" controller with list and edit view for it (to view add/edit/delete parents)
and a "Children" controller same thing (view list add/edit/delete children)
and now i need to refactor; to put the children view inside the parent view, so that when you edit a parent you can see the list of his children and edit/delte/add...
My custom error messages quit working somewhere along the way and I'm getting this error. Any ideas?
Autofac.ComponentNotRegisteredException: The requested service 'controller.error.aspx' has not been registered.
I have never done anything to register them before.
I saw several questions about the custom error messages, but I couldn'...
I have this sort of format
asp.net MVC View -> Service Layer -> Repository.
So the view calls the service layer which has business/validation logic in it which in turns calls the Repository.
Now my service layer method usually has a bool return type so that I can return true if the database query has gone through good. Or if it failed...