asp.net-mvc

ASP.Net MVC 2 - button click on view is not calling any method in the controller? what am i missing?

Am trying my hands on asp.net mvc2 and using mvc2 template to work upon. Following the template, i created my own model, controller and view in there respective folder locations. i also changed the default routing in global.asax for this controller and view. now my view is getting loaded but when i click on a button in my view, none of t...

MVC Abstract Base Controller Override parameter type for modelbinding

For simplicity's sake, lets say I have the following Abstract Base Controller Class: public abstract class RESTController : Controller { public abstract JsonResult List(); public abstract JsonResult Get(Guid id); public abstract JsonResult Create(object obj); public abstract JsonResult Update(object obj); publi...

Custom DataTypeAttribute not triggering validation correctly

Related to this question I have created my own DateValidationAttibute to make sure a string is in a valid date format (e.g., MM/DD/YYYY) [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)] public class DateValidationAttribute : DataTypeAttribute { public DateValidationAttribute() : base(DataT...

ASP.NET MVC strongly typed master page out of Views folder

I have an MVC application with custom view engine implementing theme selection, i.e. dynamic setting of views' master pages. The app structure is described here The issue is that master pages exist out of their default location in Views folder. (That is because I want all theme-related files, ie. css and images to be at one place togeth...

showing context menu in contentEditable div

I have a contentEditable div with following text for example: <div contentEditable='true'> This document is classified</div> Now for example if user clicks on 'm' in word document I want to show a context menu containing few text choices. That context menu will be contained in a div element. I want to replace the word "document" with ...

asp.net mvc using HREF in application running on IIS

There is a partial view representing pager control (very similar to this) for blog content. Code generates HTML with references and href like, "/Blog/Posts/Page/1", "/Blog/Posts/Page/2" etc. It worked absolutely fine on Cassini, but after I switched to IIS problems appeared. IIS application running in virtual folder, so URL is http:...

Is it possible to remove references to System.Web.UI.*?

This may be a dumb question, but is it possible to remove references to System.Web.UI.*? For example, my application has two custom classes that are called Panel and Control, but I can't refer to them as such in the code because they conflict with the classes in System.Web.UI. Since I'm working in an ASP.NET MVC environment, I won't hav...

Any way to detect classic and integrated application pool in code?

I've got an ASP.NET MVC application running in shared hosting. Recently the site got munged when the application pool was accidentally switched from integrated back to classic mode. We had to change the routes until tech support got the app pool reconfigured. It would be great if there was a way to detect the application pool mode in co...

ASP.NET MVC Model vs ViewModel

OK, I have been hearing discussion about "ViewModels" in regards to MS's ASP.NET MVC. Now, that is intended to be a specific kind of Model, correct? Not a specific kind of View. To my understanding, it's a kind of Model that has a specific purpose of interacting with the View? Or something like that? Some clarification would be appr...

Search implementation using ASP.NET MVC 2 / jQuery (Performance & Security concerns)

Happy Halloween everyone, hope it was a fun night! I've just implemented an AJAX search functionality on my first ever ASP.NET MVC project, and I just want to get your feedback on security and performance. The project is going to be a simple Forum, with roughly 40 topics and 1000-3000 total posts. Let me show you some code. In my Top...

ASP.NET model binding to base type

Hi, I have a BaseViewModel that my View Models all inherit from. public class MagazineViewModel : BaseOutputViewMode { public string TitleOfPublication { get; set; } } In my controller I use a factory method to give the corret View Model back based on an input: // e.g. viewModel contains an instance of MagazineViewModel BaseOu...

Adding a JavaScript file to a view

Hi, I am using MVC 2. I have a master page and a view that uses this master page. I have to use a javascript file for this view only, and not for the other views. What is the best way to add a javascript file to this view? What I currently did was to add the javascript file at the top in my content tag. Is this the best way to do i...

MVC Views from Database

I am building an ASP.Net MVC 2 application for a client and it requires the ability for user to define views. On this website it shows how to do this - http://www.umbraworks.net/bl0g/rebuildall/2009/11/17/ASP_NET_MVC_and_virtual_views , but I ran into a few comments there and elsewhere that this was a bad idea. What would be the best w...

S#arp Architecture and NHibernate database relations

I have been starting to follow the example on http://www.sharparchitecture.net on how to create a site using MVC.NET and NHibernate. I have gotten T4 to generate a object called Author for me, and validate it at the database. I would like to create an object e.g. Book, but I can't however find any information on how I can create a man...

ASP.Net MVC 2 authentication (login) best practices

Hi guys, I am developing an ASP.Net MVC 2 application as a composite application in SalesForce.com. For those not familiar with SalesForce.com it is a CRM platform on the internet. What the composite application is it simply is shown inside an iframe in a separate tab. So when the user logs in to salesforce.com that user sees a bunch of ...

Who benefits (or is at a disadvantage) with MVC: the Developer or the Designer?

When comparing MVC to ASP.NET Forms, which one offers a better design-time experience for a web designer? ... which is better for the developer? I was just looking at the new Razor MVC syntax and think that designers may simply delete stray } that are used in for..each loops. One might say that ASP.NET WebForms offers a better web des...

ASP.NET (MVC) Get username from URL http://[email protected]

Is there any way to retrieve username from this http://[email protected] type of address in ASP.NET MVC (optionally in ASP.NET) from current request? ...

Using Facebook as single signon

I am developing an mvc.net application and would like to use Facebook Connect as single signon, but do I need to create a Facebook application from within their interface, or can I use the login features without creating an application? ...

Strange extra characters in rendered html on IE 8

I have an ASP.Net MVC site that I want to render some custom HTML 5 canvasses in. I am getting a strange issue with the server serving up extra characters that are not in the source code. In order to use an HTML 5 canvas in IE 8 you have to add the following tag in the html head: <!--[if IE]><script src="../../Scripts/excanvas.js"></sc...

Facebook API class doesn't exist anymore

I am trying to follow this guide to use Facebook on my site: http://www.deviantcoders.com/articles/aspnet-membership-and-role-provider-facebook-connect-part-2 But when I try to use API api = new API(); it can't find the class: The type or namespace name 'API' could not be found (are you missing a using directive or an assembly refere...