asp.net-mvc

ASP.NET MVC Routing strategy for static content for each View

I'm wanting for every view in my system to have some static help content. The way I was thinking about doing this would be to set up a parallel structure for the static content and create a route to rewrite the URL to this. For instance: /Controllers /Help /Account /Login.htm /Create.htm /Models /Views /Account /Login....

Can some things in the Site.Master display conditionally (MVC)?

I am looking into using a side bar menu option. This will only be displayed on some aspx pages. Can I insert in the site master, with a toggle condition, or do I go the tedious route of adding menu.ascx on each aspx page? I know how to add individually, but can I go the simpler Site.Master route? ...

How do I localize the Grid from the Telerik MVC Extensions?

I've been using the Grid of the Telerik MVC Extensions with great success, it's a great component. But now I need it's text to be in spanish. Looking for in the source code, I've only found that I can enable Globalization like this Html.ScriptRegistrar().Globalization(true); But all this line does is inserting some jQuery that tells...

Suggestions for where to put AntiXSS calls in ASP.NET MVC

I am attempting to find the optimal method of guarding against Cross Site Scripting in my ASP.NET MVC application. I planned to use Microsoft’s AntiXSS library and essentially guard on two levels: 1) Protect regular textboxes (i.e. those that should only contain plain text and 2) Protect rich text boxes which can generate HTML. The libra...

Radio button default state in a questionnaire.

I am writing a questionnaire in ASP .NET MVC. The format of the questionnaire is one yes/no question per page. The questionnaire is a safety questionnaire where, for the majority of the time the user will answer no to the questions. Should I set the default state of the radio buttons to 'no' to save the majority of the users time (enhanc...

Why is Post code being triggered on jQuery load?

I have the following functions in my ProceduresControlller: Function Add(ByVal bpid As Integer) As ActionResult Return View(GetAvailableProcedures(bpid)) End Function <AcceptVerbs(HttpVerbs.Post)> _ Function Add(ByVal bpid As Integer, ByVal code As String, ByVal covered As Boolean) As ActionResult AddProcedure(bpid, codes, cove...

Difference between Application_Start and Application_OnStart

I'm in the process of adding ASP.NET MVC code to a preexisting ASP.NET Webforms project. The various tutorials suggest adding routing to a method called from Application_Start() in Global.asax. My Global.asax already has an Application_OnStart(Object,EventArgs) method with some setup code. If I try to have both Start and OnStart, the On...

What reporting tool do you suggest for an enterprise level ASP.Net MVC application?

In one of the enterprise-level projects, we are using ASP.Net MVC for the web application portion. The reporting system is a huge system with hundreds of reports plus adhoc reporting, printing and notifications, the whole nine yards. Although we are using MVC for the web portion, the reporting doesn't need to be in the same technology, ...

Efficiently loading sitemap from database?

Hi, i have a custom SiteMapProvider which I populate from a database. I also have a custom SiteMapNode which has to be constructed with a custom Page argument. The implementation of SiteMapProvider.IsAccessibleToUser(context, node) is now: Public Overrides Function IsAccessibleToUser(context, node) As Boolean Return CType(node, Cu...

ASP.NET MVC: Hidden form field not accepting new value from model after post

In my view I currently have the following code: <%= Html.Hidden("Cart.CartID", Model.Cart.CartID) %> When the page initially loads, CartID is null so when I view source on the page the value is set to "". When I submit the form on the page (adding a product), the controller code will create a new cart and using a strongly typed viewm...

Are there any starter kits that uses all of : ASP.Net MVC 1.0 with Nhibernate. Sparkview, Jquery, Jquery UI?

I am looking for a starter kit that already is set up with the following? ASP.NET MVC 1.0 Jquery/Jquery UI/JqGrid/ Sparkview engine NHibernate Code quality is important as well. Thanks in advance. ...

MVC Route Constraint for bool

What would be a valid regex for a MVC route constraint passing a bool? For example, I have the below route: routes.MapRoute("MenuRouteWithExtension", "Menu.mvc/{action}/{projectId}/{dealerId}/{isGroup}", new { controller = "Menu", action = "RedirectUrl", projectId = "", dealerId = "", isGroup = "" }, new { projectId = @"\d+", dealerId ...

Redirect from one Area's action to a action in the "root"-area?

I use the latest version of ASP.Net MVC 2 RC. My question is, how do I redirect from one action that's in the "Blog"-area to the index-action in the home-controller that exists in the "root" of my application (no area)? I tried: return RedirectToAction("index", "home"); but this redirects to /Blog/home, where Blog is the name of my ...

Get Model back in Post.

Is there any way to get information from my model during a result flagged HttpPost if I cannot pass it as a parameter? [AcceptVerbs(HttpVerbs.Post)] public FileUploadJsonResult Upload(HttpPostedFileBase file, IwantMyModelToo! ) I can't really get the actual view model to go through the method, though. Any thoughts? Here is th...

Reusing validation attributes in custom ViewModels

Hi, When I started using xVal for client-side validation, I was only implementing action methods which used domain model objects as a viewmodel or embedded instances of those objects in the viewmodel. This approach works fine most of the time, but there are cases when the view needs to display and post back only a subset of the model'...

Identify a sub-object given a prefix reference string, like TryUpdateModel() does

I have a complex ViewModel object being used in a base controller class. For simplicity it looks like this: public class FruitBowl { public Apple[] apples; public Banana[] bananas; } public class Apple { public string appleType; } Now, if I called TryUpdateModel(myFruitBowlObj, "apples[0]"), the model binder will identif...

Enumerating Folders With MSBuild

Hello, I am coming up on the end stages of an Asp.Net MVC 1.0 project in VS2008 / Framework 3.5, and trying to do some performance optimizations. In my project, I have a few different "themes" that are used, depending on the role of the logged in user. My themes folder structure is like so... \Themes \Theme1 \Css ...

ASP.NET MVC check form input is valid on submit

Hi all, I have a form that, when submitted, shows a busy animation and disables the submit button. Anyone know how to query Microsoft's Sys.Mvc.FormValidation to see if the form passed its test so I can prevent the busy animation showing if the form hasn't actually been submitted? Is there some other work-around? At present my client ...

How to do routing for Phil Haacks area prototype for ASP.NET MVC 1.0 ?

Hi, I am building a simple web site for a client and this is my first time with ASP.Net Mvc. For the production i need to use MVC 1.0 and the most efficient way to saparate Admin logic from the rest of this site is using Areas. The fact that i couldnt use MVC 2, so i have used the Haacks area prototype and everything was ok. I want to...

ASP.NET MVC model defaults on post

I have an ASP.NET MVC App, where I have interfaces for each viewmodel. On a view called /Product/Details/50 I can edit details for product with id = 50. I use strongly typed views, with the type being IProduct. I use Castle Windsor to do DI. When I post the edit form on the /Product/Details/50 view, the IProduct instance defaults to wh...