mvc

Extending Sanderson's custom mvc ModelBinder for an object stored in session

In his wonderful MVC book Steven Sanderson gives an example of a custom model binder that sets and retrieves a session variable, hiding the data storage element from the controller. I'm trying to extend this to cater for a pretty common scenario: I'm storing a User object in the session and making this available to every action method a...

asp.net mvc views and strongly typed viewdata

I prefer strongly typed viewdata for my asp.net mvc views for various reasons and I actually preferred the Views with codebehinds as they were in the earlier asp.net mvc previews because the codehind was a natural place to define the poco viewdata class as they generally have a 1:1 relationship with the actual view. Are there any way to...

Is Databinding a good way to connect a view to a model

I am thinking about the design of a WPF or Silverlight application. I am planning to use MVC (or another such design pattern) Witch ever of the design patterns I choose, I need to connect to view to the model (or presenter) – is databinding a good way of doing this? (In the past with WinForms applications I have found that Databinding...

MVC 1.0 & the Authorize Attribute Not Working?

I'm writing an application with MVC and I'm at the point where I need to start applying the authorization checks but I can't get them to work under any conditions. I'm using Windows Authentication on a system that's a member of an internal domain. Authentication works fine, and the roles are populated as well. But no matter what value I ...

asp.net Chart Controls on a user control in MVC

Hello Fellow Developers, I am new to the MVC Framework. Im working on a dashboard project in the MVC framework. The project consists of a bunch of charting control in a user controls contained in a master page. I did a test on a charting control on a aspx page..and it works...but when I moved the code to a ascx (usercontrol) the chart ...

ASP.NET MVC ContentPlaceHolder overriding hard-coded content

This is what I have in the aspx page: <head runat="server"> <title>Website - <asp:ContentPlaceHolder ID="HeadContent" runat="server" /></title> </head> This is what's in the view: <asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server"> Homepage </asp:Content> For some reason, this HTML is generated: <...

How to get the value of datafieldtext or selectedtext of the selectlist in asp.net mvc?

No javascript\AJAX is to be used. ...

Trouble with ASP.NET CAPTCHA Control Sample with ASP.NET MVC

I am trying to use the following A CAPTCHA Server Control for ASP.NET - by Jeff Atwood within an ASP.NET MVC site. The custom control doesn't seem to be validating when the form is submitted. Is there anyone who has done any work with this sample using ASP.NET MVC? The basic code I am using is as follows: <% using (Html.BeginForm()) ...

How do I find the absolute path of a controller action?

I need to generate a link to an action and send the link by email. I'd like to call something like this: public string GetAbsolutePath(string actionName, string controllerName, string id) { // Somehow generate the absolute path } I think I can use VirtualPathUtility.ToAbsolute(string virtualPath) but I'm not sure how to get the vi...

How to prepare asp.net web forms for smooth conversion to asp.net mvc

I would like to prepare my existing asp.net web forms application for a smooth conversion to asp.net mvc. I have architected my app as follows POCO entity layer is used to pass through all tiers Data layer Business layer UI layer - no view state; no post back; only two things are in code behind, a) populating form, list view, dropdown ...

How to add CSS class atttribute for Html helper methods in asp.net mvc (VB.NET)?

Name: <%= Html.TextBox("txtName", "20", new { @class = "hello" }) %> I want that in VB.NET , is it .cssclass="hello" or is it something else? ...

jQuery DateTime picker and ASP.NET MVC

I'm currently using a jQuery Date Time picker to select a date time to be put in to a database. When using the date time picker, the result shows up properly in the text box it is bound to (IE 27/09/2009 16:00). However, the date time is not being passed to the MVC application properly, and is being received as 01/01/0001 00:00:01. The...

How to skip ActiveRecord callbacks?

I have model like this class Vote < ActiveRecord::Base after_save :add_points_to_user ..... end Is it possible to somehow force model to skip calling add_points_to_user when saved? Possibly something like ActiveRecord#delete vs ActiveRecord#destroy? ...

Using an MVC HtmlHelper from a WebForm

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...

MVC Deployment Problem - Site Loads but Links (Routes) do not

Having a problem deploying an MVC application. Basically the site loads correctly, the home page appears. However anything which needs to access a controller action does not. So all the links just throw up 404 errors. Does anyone have an Idea why the site loads but after that the controller actions appear not to? Thanks ...

Jar placement for Web Apps using WebLogic

This seems like an elementary question, but I want to make sure that we're doing things right. We're making webapps using Spring MVC and serving them using WebLogic. Where should jars be placed in this setup? We have talked about placing business logic into jars that would live in the server classpath and app-specific jars would be pac...

.Net MVC: Read master page path from any view

Hi I have a method RenderToString(string pathToView, string pathToMasterPage) which, like the name already says, renders a view and returns the result as a string. Currently I have to pass the path to the master page as a paramter to the method. But since the view itself allready contains the definition of the master page <%@ Page...

How to create a pop-up window in asp.net mvc?

No javascript/AJAX to be used. when clicked on the hyperlink, it should open a new browser window. ...

RedirectToAction(..) with complex deep object fails

Hi, I'm trying to pass an object from one controller action to another. The object that I'm passing around looks more or less like this: public class Person { public string Name { get; set; } public List<PhoneNumber> PhoneNumbers {get; set; } public List<Address> Addresses { get; set; } } My Controller looks like this: publ...

Implementing a service layer in an MVC architecture

How would one typically implement a service layer in an MVC architecture? Is it one object that serves all requests to underlying business objects? Or is more like an object that serves different service objects that in their turn interact with business objects? So: Controller -> Service -> getUserById(), or: Controller -> ServiceMana...