asp.net-mvc

Blog engines for ASP.Net (maybe MVC) web sites

I've built a web site on ASP.NET MVC and one little section of it should be a blog. I'm looking for a blog to integrate. In the worst case scenario it'd be a WordPress with a custom skin and RSS integration to the rest of the site. The best would be to have an ASP.NET MVC add-on, but I can live with ASP.NET WebForms. Do you have any rec...

JQuery Cascade dropdown problem?

Hi All! I'm using JQuery based Cascade plugin probably it's working, but I found a lot of problems with it Maybe somebody already faced with this plugin and maybe could help. So, I using this plugin for location filtration Here comes my CS code: public JsonResult getChildren(string val) { if (val.IsNotNull()) { int lId = ...

Policy Injection with ASP.NET MVC Controllers

I'm running into an issue with the Policy Injection Application Block from Enterprise Library in conjunction with ASP.NET MVC. In my ControllerFactory, I'm creating the controller and then calling PolicyInjection.Wrap on the controller. This gives me back a Transparent Proxy to the controller which manages the call handler chain. Final...

How to update Model in MVC

Hi, I'm wondering how you keep a constant value of the Model in an ASP.NET MVC framework. Like when adding something to the Model through the view. You go back to an action in the controller but where do you keep the Model? Is it a private in the controller? or is it passed back and forth from the view to the controller because if i...

setting page title when using strongly typed view data in asp.net mvc

Hi, How can I set the page title in asp.net mvc using strongly typed views AND a master page. I added a public property to my master page class, but can't seem to get access to it in my view/action. ...

Can somone help me understand this tutorial better?

Hi I am trying to go through this tutorial tutorial . This tutorial seems to do everything that I been looking for but I am having trouble trying to understand it. Maybe it is because I don't know enough of Xval, jquery.validate. 1st He seems to be using a typed view: RemoteValidation.Models.User. What happens if I want to pass some ...

ASP.NET - Why is my cookie not persisted?

Hi, i'm trying to set a cookie to store a selected department in. The cookie is set with a small form which has a select-dropdown with departments. This is posted using AJAX. This is how I store the cookie: <AcceptVerbs(HttpVerbs.Post)> _ Function ChangeDepartment(ByVal FormValues As FormCollection) As ActionResult If Response.Coo...

Asp.NET MVC: Practices questions

1) Isn't it a bad practice to use these attributes on all of my Controllers? [HandleError] [CompressFilter(Order = 1)] Compress filter is defined as: public class CompressFilter : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext filterContext) { if ( !AppConfig.IsResponseCompressionEnabled ) {...

How to integrate axd (Elmah) as component in ASP.NET MVC site

I have Elmah up and running in my ASP.NET MVC site and I would like to integrate its interface with the administration pages of the site. By default, you invoke the interface with the url ~/elmah.axd, which runs outside the MVC system. The installation requires you to tell MVC to ignore the route, so there's no controller or anything tha...

How to handle localization in JavaScript files?

I want JavaScript code to be separated from views. I got the requirement to implement localization for a simple image button generated by JavaScript: <img src="..." onclick="..." title="Close" /> What's the best technique to localize the title of it? PS: I found a solution by Ayende. This is the right direction. Edit: I got Localiza...

How does ASP.NET MVC know that a method is an action method?

I'm trying to write a unit test that will loop through all action methods on my controller classes looking for action methods that don't have some security-related attribute on them (e.g. [Authorize]). How does the ASP.NET routing engine determine which methods are action methods? Obviously the action methods have to be public, but m...

Routing depending on optional action value in url

Being rather new to ASP.MVC I'm looking for a solution to the following routing problem. I want these Url's to lead to the shown pages: /Member/123/A+Strange+Username -> page with members details /Member/123 -> as above /Member/Connections/123 -> page with list of members connections /Member/Connections/123/A+Strange+Username -> as abo...

What is the MVC way of simultaneously sending a file and redirecting to a new page?

I have a form which users must fill out and submit. The controller action does some work and decides the user can have a file and so redirects to another action which is a FilePathResult. [CaptchaValidator] [AcceptVerbs(HttpVerbs.Post)] public ActionResult Index(FormCollection collection) { // do some stuff ... ...

How does the ASP.NET MVC UpdateModel() method work?

I'm working on my first .NET MVC application and using the NerdDinner tutorial as a reference point. One point that is intriguing me at the moment is the UpdateModel() method. (I don't like using things I don't really understand.) Taken from the NerdDinner tutorial - // // POST: /Dinners/Edit/2 [AcceptVerbs(HttpVerbs.Post)] public Ac...

ASP.NET MVC: Binding numeric types from blank strings without ModelState errors

I have a fairly complex ViewModel containing decimal properties, which are exposed to the user in the form of text boxes. I want a textbox with no value to be interpreted as zero. (The properties in the underlying domain object are non-nullable, and the default value is 0.) When the DefaultModelBinder binds the view data to the ViewMode...

Where do you put non-controller, non-model code in a ASP.Net MVC project?

Where do you put non-controller, non-model code, like util classes, extension methods and so on in a ASP.Net MVC project? Maybe there's not a specific place to put it, you just put it anywhere, if so, any recommendation? Any best practices? ...

How should my MVC Model work with my Business logic classes?

So I have a MVC app and in another project I have a normal collection of classes which handle the Business and Data logic for the application. I also have some logic in the Model of the MVC project itself. This logic handles ViewModels and the like, things which could not have been done in the n-tier project as they relate to the MVC pro...

Return to calling page from a shared page

I have a shared page in my ASP.NET MVC app that can be accessed from several different pages in my app. If I want the user to return to their original page after they have done their business on the shared page, what's the best way to figure out where the user was, and tell the app to go there? Note that I'm currently doing this for the...

How to access HTML files from ASP.NET MVC VIEWS Folder

Hi All, I will like add conventional HTML page under VIEWS folder (in ASp.NET MVC) page. I have added the route exceptions as mentioned below. routes.IgnoreRoute("{resource}.htm/{*pathInfo}") routes.IgnoreRoute("{resource}.html/{*pathInfo}") Although it does work when I put the html files out of VIEWS folder but I get Page ...

Multiple update target ids with Ajax.ActionLink ASP.Net MVC

Is there a way to specify multiple update target ids with Ajax.ActionLink so that I can render a set of partial views on callback? The problem that I'm seeing is that Ajax.ActionLink only provides one target id for me to update, but what I need is to update multiple regions of the page with different data after an ajax call. Any help...