I have a View strongly typed to an Item class. In my controller I need to send two different List. Is there an easier way to do this other than creating a new class with two List.
What I am ultimately trying to do is have on my homepage 10 items ordered by Date, and 10 items ordered by Popularity.
WHAT I DID
I actually went with a...
I'm slowly modernizing: Can I run the ASP MVC example NerdDinner on my XP Pro system? I know there is a possible issue with IIS5.1 being too old.
...
I have an ASP.NET MVC website and an area project called 'Admin'.
So far the routing works fine, except that it seems I can't have 2 controllers with the same name in each project.
I thought the following URLs would both work fine:
http://website.com/Home/Index
http://website.com/Admin/Home/Index
But it turns out that I get ...
I'm just getting up to speed with asp.net mvc and I'm wondering how one would go about getting relational data more than one level deep from the entity specified in the from clause. Using the following domain model as an example:
A Blog has many posts. Posts have many comments.
How would I write a LINQ query to return entities down to ...
Hi everyone,
I am passing a query string with name "RowTobeHighLighted" from my Asp.net mvc action result.
What I have to do is, I have to get the query string value from that controller action to a script of type text/javascript. I have tried to use simple Request.Querystring() under javascript. But that is not working. Can anybody ple...
I am currently developing a sample application in MVC. The specification is as follows:
1. Single partial view for a grid.
2. The model will be stringly typed to a list of domain objects so that I can pass anything to the grid
3. I can drop this view into any page and decorating the controller with some attributes I can handle typical pa...
I have a custom viewmodel inside which I have two fields and one linq2sql entity .. all fields have Validation Attributes attached. Even if all fields are invalid only the fields in the linq2sql class are visually indicated for error and fields in the viewmodel are displayed normally. But the error messages are displayed for all invalid ...
I don't know whether I'm just stupid (don't answer that!) or I'm fighting MVC routing but I have another problem.
In my Controller I do a RedirectToRoute("ErrorRoute") which renders a 404 View which has a MasterPage.
In the MasterPage I have a top navigation which has links such as /homepage and /news but when I am in the 404 View the ...
Hi,
I've got a series of views, each are typed to have their own ViewModel class which contains everything they need to display themselves, for example:
public class CreateResourceViewModel
{
public Project Parent { get; set; }
public SelectList Categories { get; set; }
public Resource Resource { get; set; }
}
The post...
Hi all,
Is there a pre-built ModelBinder I can use with LINQ to get an object from a DataContext and update it on a HTTP post?
For example, currently I have this block of code:
[AcceptVerbs (HttpVerbs.Post)]
public ActionResult Edit (Project project)
{
var projectService = Factory.GetService<IProjectService> ();
project = proj...
Is there a way to keep the impromptu dialog box displayed during a post?
Here's the javascript code
$('#linkPostTest').click(function() {
openprompt();
});
function openprompt() {
var temp = {
state0: {
html: 'Are you sure you want to post?<br />',
buttons: { Yes: true, No: false },
...
I want to learn more Asp.Net (and MVC). I would like to say I am a decent developer, but everything I work on seems to be maintenance or enhancements. I want to start a website or web app completely from scratch. I would prefer to use MVC, but whatever the better framework, I would use. I also want to make it for myself (maybe eventu...
We (me and my team) have a ASP.NET MVC application and we are integrating a page or two that are Web Forms. We are trying to reuse the Master Page from our MVC part of the app in the WebForms part. We have found a way of rendering an MVC partial view in web forms, which works great, until we try and do a postback, which is the reason f...
I'm working on adding authorization to an ASP.NET MVC App and have run into a road block. I was finally able to get our custom membership provider wired up and get authentication working for the App. Now, as expected, if I add the [Authorize] attribute to my controllers, the user must be authenticated to view the page. I have also succe...
When requesting http://someserver.com/user/btyndall
I'd like to return HTML
When requesting http://someserver.com/user/btyndall?format=xml
I'd like to return XML representation of my model
I've downloaded MvcContrib. (I can't believe XmlResult is not a part of the core framework)
What is the proper way to handle the request in the cont...
I am using Ajax.BeginForm in ASP.NET MVC to post a form. I have one div being updated using AjaxOption's UpdateTargetId property. Now I need the post to update 2 Divs. I also need to return 2 different views.
Here is the code that I have presently:
<%using(Ajax.BeginForm("Create", new { controller = "View"},new AjaxOptions { UpdateTar...
I'm buiding a UrlHelper for a route
as in best practices
the problem is that the returned value is always null
when debugging in found that
Url.RouteUrl("x") return null
Url.RouteCollection["X"] return Route
i'm trying to do :
public static string Category(this UrlHelper helper, int Id, string category)
{
return helper.Route...
I'm wondering if anyone knows if xVal will work as expected if I define my system.componentmodel.dataannotations attributes on interfaces that are implemented by my model classes, instead of directly on the concrete model classes.
public interface IFoo
{
[Required] [StringLength(30)]
string Name { get; set; }
}
and then in my ...
Inside of my MVC application, I have a sub-folder named "Admin" that was "Converted to Web Application". In IIS, the Admin folder has also been setup as a web-application.
After publishing my full application, I get a Configuration Error when trying to open Default.aspx within the Admin folder.
EDIT
I made the suggested change an...
Hi!
I'm creating a custom role provider and I set a Authorize attribute specifying a role in my controller and it's working just fine, like this:
[Authorize(Roles="SuperAdmin")]
public class SuperAdminController : Controller
...
But when an user doens't have access to this controller, he's redirected to login page.
How can I redirect...