asp.net-mvc

Binding a list belonging to another object in a custom model binder in ASP.NET MVC

I realize something like this has been asked, but this may be a little different Below is my Event object: Event : IEvent public int Id public string Title public List<EventContact> Contacts And EventContact: EventContact public int Id public string Name public string Email So, an Event has a list of EventContact objec...

Best Practice for Summary Footer (and the like) in MVC

Simple question on best practice. Say I have: public class Product { public string Name { get; set; } public string Price { get; set; } public int CategoryID { get; set; } public bool IsAvailable { get; set; } } and i have a view using IEnumerable< Product> as the model, and i iterate through the Products on the page ...

Can we make ASP.NET MVC project to compile on-the-fly just like ASP.NET 2.0?

I really love ASP.NET 2.0 for being able to make code-behind changes without neededing to re-compile project. Now I have moved to ASP.NET MVC but one thing that bother me is the fact that I need to re-compile everytime I make a change in the Controller code. How can I make my ASP.NET MVC application to compile on-demand like ASP.NET 2....

How can I include an external JavaScript file exactly once per partial view?

I have a partial view (UserControl) that implements a simple pager in my Asp.Net MVC project. This pager needs access to a .js file that needs to be included exactly once, regardless of how many instances of the pager control are present on the parent page. I've tried to use Page.ClientScript.RegisterClientScriptInclude, but it had no e...

Is ASP.NET MVC 2.0 released yet?

Does anyone know if this has been released yet? I went to asp.net and the Windows PI installs MVC 2 and it doesn't mention anything about RC's but then Scott Guthrie doesn't mention anything on his blog either. ...

DisplayName attribute from Resources?

Hello! I have a localized application, and I am wondering if it is possible to have the DisplayName for a certain model property set from a Resource. I'd like to do something like this: public class MyModel { [Required] [DisplayName(Resources.Resources.labelForName)] public string name{ get; set; } } But I can't to it, as the c...

How to make XML file in asp.net mvc?

hello, i want to make XML file for RSS news. Can anyone tell me How to create XML file? Thank You. ...

How to get ViewData in Script in MVC?

Hi, I want to execute a function on loading the partial view. I have my partial view as follows. I am trying to call the function from script. But I think I can not use ViewData in my script. I don;t know proper way to use viewdata in script. Is there any way to access the viewdata inside script. <%@ Control Language="C#" Inherits="Syst...

[Google Maps] Trouble with invalid argument when switching jQueryUI based tabs

Here's a page with the issue To reproduce the error, using IE - click the directions tab, then any of the others. What I'm trying to do is this: On page load, do nothing really. However, when the directions tab loads - setup the map. Like so: $('#tabs').bind('tabsshow', function(event, ui) { if (ui.panel.id == "tabs-5") { ...

ASP.NET MVC TextBoxFor helper rendering empty when null

I noticed that TextBoxFor helper renders empty if there is no model, like for instance when I have a CreateEdit ViewUserControl. When in Edit view fields are filled in, when in Create fields are empty but still rendered. The problem is TextBoxFor does not accept different Id for its name (the same as LabelFor and others, but for LabelFo...

Can I run asp.net mvc 1 on .net 4?

I have a asp.net mvc site that references a couple of libraries. Recently I discovered that it is necessary to migrate those dlls to .net 4 (I mean compile them for .net 4). Can I run asp.net mvc 1 on .net 4. Migration to asp.net mvc 2 is postponed because of the removal of response.WriteSubstitution(...) method. ...

Creating Html Helper Method - MVC Framework

I am learning MVC from Stephen Walther tutorials on MSDN website. He suggests that we can create Html Helper method. Say Example using System; namespace MvcApplication1.Helpers { public class LabelHelper { public static string Label(string target, string text) { retu...

ASP.NET MVC and mixed mode authentication

Hi All I have a scenario whereby I require users to be able to authenticate against an ASP.NET MVC web application using either Windows authentication or Forms authentication. If the user is on the internal network they will use Windows authentication and if they are connecting externally they will use Forms authentication. I’ve seen qu...

ASP.NET MVC controllers with identical names

Hi! Here's what I'm trying to do. I have an ASP.NET MVC web application, where I'd like to have a separate "admin" area (accessible via http://example.com/admin) and a regular area, available for all users. In both these parts of the site I have a /blogs section, but when accessing http://example.com/admin/blogs I want to be presented ...

How to gather arbitrary length list data in ASP.NET MVC.

I need to gather a list of items associated with another item from my user in a ASP.NET MVC project. I would like to have a controller action like bellow. [AcceptVerbs(HttpVerbs.Post)] public ActionResult Create(int x, int y, IEnumerable<int> zKeys) { //Do stuff here } How can I setup my form to pass data in this way? If data of...

Migration from ASP.NET MVC2 Priview 2 to MVC2 RC: Any breaking changes?

Hi, I'm trying to migrate from ASP.NET MVC2 Priview 2 to MVC2 RC, because new version of Telerik is enforcing it. I had big problems while migrating from MVC 1.0 to MVC 2.0 Preview 2, so I wanted to confirm with you guys before continuing. Has anyone migrated from Prev2 to RC? Was there any problems? Are they easy to solve? Any sugges...

How to organized page specific CSS link tags with spark view pages and application.spark

I'm currently using ASP.NET MVC 2 and the spark view engine. The main master page (application.spark) contains all of the CSS link tags that need to be present for all pages (global stuff). However, I have some content pages that have page specific CSS tags and currently I'm just sticking the link tag in the body as something like: <c...

How can I stop an auto-generated Linq to SQL class from loading ALL data?

UPDATE: from what I'm hearing, I was imagining the problem I describe below. So, this is pretty much a non-question. Future readers, move on... nothing to see here. I have an ASP.NET MVC project, much like the NerdDinner tutorial example. (I'm using MVC 2, but followed the NerdDinner tutorial in order to create it). As per the instru...

Inclusion Handling in MVC 2 / MVCContrib

I'd like to improve my page by combining and minifying javascript and CSS files. Since MVCContrib already contains a project called IncludeHandling, I took a look at that which unfortunately left me with unanswered questions: There is quite a set of interfaces and objects involved in the process. Now I'm using Ninject.Mvc, but it seems ...

ASP.NET MVC 2 Form Not Passing Values

Hi, I have a strange problem happening today. I am running the latest version of the MVC V2 framework and have been having no trouble at all - I came in this morning and for some reason values aren't being passed in to actions. To clarify lets say I have something like this: <% using (Html.BeginForm("Register", "Registration", FormMet...