asp.net-mvc

How to unit test client-side jQuery/Javascript inside ASP.NET MVC?

Microsoft has really been pushing ASP.NET MVC, and one of its major strengths over ASP.NET Web Forms is unit testing. Then, they announced that they would support jQuery as their official client-side library for the platform, automatically including the source in new projects. Recently, they announced their first official contributions t...

Does ASP.NET MVC 3 Preview 1 (or the eventual RTM) supports .NET 3.5

I've been looking for information regarding if the third version of ASP.NET MVC will support .NET 3.5 or not. I haven't been able to find anything that either confirms it or denies it. ...

AJAX call in jQuery form submit function

I'm using ASP.NET MVC. So I have a form on my page: <form id="MyForm" name="MyForm" method="post" action="http://www.mysite.com"&gt; <input id="hdnType" name="hdnType" type="hidden" /> </form> I'm using the jQuery submit action to do some validation before the form is posted. I also need to make an AJAX call to set "hdnType" based...

What does Html.HiddenFor do?

Although I have read the documentation on Html.HiddenFor, I've not grasped what is it used for... Could somebody explain its uses and give a short example? Where should those helpers go in the code? ...

ASP.Net MVC 2 - Merge all outputs to a single assembly

I have a Web Deployment Project in my solution. The solution consists of the MVC2 App and another Class Library. In the Web Deployment Project properties I have the Merge all outputs to a single assembly option ticked and I have given it a name. When I look in the bin folder I have all my reference DLL's from my MVC app, a DLL with th...

SSO security considerations

Hi all, I have a sso mechanism already implemented thaty works perfect with redirects (site A redirects to SSO for login which takes it back to A after successful login) now I want to implement a set of web services to achieve the same functionality but without having to post back to the SSO service. The login works in the following ...

Model design in ASP.NET MVC

I am constanstly having problems with model design in MVC. Mostly all of my projects require some entities that are to be created, edited and deleted. Most of these entities have some common properties like creation date, modified date, author, modified by and in some cases even more descriptive properties are common. Because of that I h...

Updating input fields after Ajax post

I'm doing my first web app (not new to programing) and I have a little problem that I know why I have it but I need a way to sort it out. I make an ajax post on a page, that ajax post uses two hidden fields to retrieve some data, send it to the Action and get some json to show up. Perfect. The thing is that I'm changing the content of ...

Partials With View Data Object

I have the following ViewData that I pass into a view. public class MerchantSignUpViewData : BaseViewData { public Merchant Merchant { get; set; } public Address Address { get; set; } public Deal Deal { get; set; } public List<MerchantContact> Contacts { get; set; } public int TabIndex { get; set; } public List<D...

The new jQuery Templates from Microsoft and SEO

Scott Guthrie just blogged about the new jQuery Templates that his team has been working on, and I must say... this looks really sweet. I have a multi-part question however, where the answer will influence my decision to use them. I'm currently working on a project whereby the home page displays a list of upcoming events in your region....

ajax.beginform and xVal

I am using Ajax.BeginForm to submit a form ans xVal to enforce validation The problem the ajax post request is being made even when the form has errors on it. I know client-side validation is working, because it is displaying proper error messages and what not, but why it thinks it is okay to make the ajax request anyway is something I...

problem in routing in asp.net mvc

i have routes.MapRoute("BuildingCompanyProject", "BuildingCompany/{projectId}/BuildingProject", new { controller = "BuildingProject", action = "Index", projectId = "" }); in Global.asax.cs and is placed below the default route. and the above route is called on clicking a link <a title="Go toCompany" style="background: none!import...

Jquery Datetime picker Date format Issue

I am using jquery datetime picker. it is showing date in "yy/MMM/dd hh:mm:ss" format on selecting the date and time. i am not able to change its format. How can i change it to my custom format "dd/MM/yyyy hh:mm" ...

Wordpress-like Plug-in model in ASP.NET MVC

This is kind of based off of this question. I'm currently looking at rebuilding our company intranet from the ground up (I'll be honest, our existing one is an absolute mess), but one of the core "features" of our new intranet that I'd like is the ability to build whole applications (which will also probably be in MVC 9 times out of 10,...

How can structure mostly static pages in ASP.NET MVC

I have mostly static view pages, for example: http://www.yoursite.com/games/x-box-360/nba-2k-11.aspx http://www.yoursite.com/games/psp/ben-10.aspx How can I construct this in my controller? This is what I coded earlier in my games controller: [HandleError] public class GamesController : Controller { public ActionResult ben-1...

MVC: I have loaded a cascading drop down list using Jquery. However my selection does not update the underlying model.

I have 2 dropdownlists, the second (department) cascades from the first (division). I use a jquery script to update the second drop down list. When the user clicks submit, the underlying model is updated, apart from the new value for department. 2 ideas I have for fixing this are; a) Generate a postback. Prefer not to do this because of ...

What is the difference between Models, Domains, Repositories and Services in the MVC paradigm?

Are Models and Domains and Repositories essentially the same thing? ...

asp.net mvc executable scripts in textbox injection

I want to know how to handle executable scripts in a textbox / ckeditor / any input control. For example, if I enter: <script>alert('hi')</script> How should I handle this script in the textbox / ckeditor / input control? ...

Globally add "<@Assembly>" and "<@Import Namespace>" to Asp.net MVC views

Instead of writing <@ Import Namespace="Microsoft.SharePoint" %> on every view I create I know I can easily just edit my web.config file and add this: ... <pages> <namespaces> <add namespace="Microsoft.SharePoint" /> </namespaces> </pages> But this doesn't seem to work in design time. Visual Studio 2010 is not able ...

How to inject a CSS file from an ASP.NET MVC partial view (server-side)?

I have a partial view (.ascx) that should include its own CSS file as it's used in multiple other views. How do I inject a stylesheet in the page server-side, i.e. without using JavaScript? ...