asp.net-mvc-2

How do I need to get My dropdownlist box value to the controller using asp.net mvc

Hi I have this code in my view.. <%=Html.DropDownList("ProductTemplate",new SelectList(Model.ProductTemplate,"Value","Text"))%> I know if this dropdownlist box is in between BeginForm submit I can able to access the value in Controller using collection["ProductTemplate"]; if it is not in my beginForm still I can able to access this s...

Domain Object in Views

We've been having a discussion at work about whether to use Domain Objects in our views (asp.net mvc 2) or should every view that requires data be sent a ViewModel? I was wondering if anyone had any pros/cons on this subject that they could shed some light on? Thank you ...

MVC2: How to mask a simple dot in a string?

This works fine: Controller.cs ViewData["MyText"] = "Hello World"; Index.aspx <%: Html.Label(ViewData["MyText"].ToString()) %> But the complete text is not displayed when I add just a dot "." to "Hello World". I thought "<%:" takes care for this but it seams that this is not true... How to solve this? How to mask the dot? Cha...

Getting compile exception inside ActionFilter when accessing Request Object

I have this little bit of code: using System; using System.Web.Mvc; public class SecureFilter : RequireHttpsAttribute { public override void OnAuthorization(AuthorizationContext filterContext) { if (null == filterContext) { throw new ArgumentNullException("filterContext"); } if (null...

Adding Reporting Capabilities to MVC?

Background: I currently have a Web Forms, ASP.NET 3.5/C# application which I'm interested in converting to MVC 2. It's a relatively tiny app so the exercise shouldn't take too long. The two primary functions the appliction does is allow users to 1) view and enter their data - metrics 2) view output reports of this data aggreggated at ...

Cannot get xVal to work with CKEditor in ASP.NET MVC 2 app

I'm having some trouble getting the CKEditor html editor control to work with xVal. For the most part, xVal is working great for me. I am able to set up the remote validations with ease, and get them to execute on the client side. However, I recently added a CKEditor rich text editor textarea to my page and everything started to go pe...

MVC2 nested master could not load type?

I've just begun experimenting with nested masters in MVC2. I'm not quite sure why I am getting this error. Parser Error Message: Could not load type 'MySite.Views.Shared.Master'. I used the add item wizard, created Master.master, and selected it's master to be Site.Master. In one of my views I changed the MasterPageFile from Site.Maste...

jquery post to actionresult that renders a partial view broken on deployment

Everything works perfectly fine in debug but silently blows up on the live server. Here's my jquery which checks to see what is selected in a dropdown box on the page: <script type="text/javascript" > $(document).ready(function () { $("#Schools").change(function () { if ($("#Schools").val() != "") { ...

Ecommerce shopping cart - is there a great opensource to use as a base

This question comes close to what I wanted to find out. Is there a Gold Standard? I am looking for an open source ASP.Net MVC 2.0 based ecommerce web site to use as a reference to custom build my own. Features that I am looking for: Affiliates and Management Coupons Reseller and Management Popular payment gateway integration Other ...

Help with refactoring Views and Master Pages in asp.net mvc 2

Im trying to refactor an asp.net mvc that is one big mess of code... it really is astonishing. I wouldnt know where to start to fix this monster... Anyways. Please Give me advice... Anything. There are different roles.. and each different role sees a somewhat different page layout. these roles are: medic, patient, company, admin They...

ASP.NET MVC 2.0 (VS 2010) website altered behaviour simply by deploying to IIS 7

I came across a strange problem with a website that I am working on when I moved it from Visual Studio 2010 (Cassini) Webserver to IIS 7 running on Windows 2008. Given the following class as the viewmodel posted back to the server: public class NominateViewModel { public Models.Category Category { get; set; } publi...

ASP.NET MVC2 IoC: Looking for an example using CastleWindsor container that works with minimum config

I am looking for an example of how to configure an ASP.NET MVC2 project to use CastleWindsor container to do IoC. I keep running into problems setting it up, and for every problem there seems to be a solution on-line, but in the end I make so many changes and end up with such a verbose setup to get IoC working using CastleWindsor, that ...

Twitter-like routes in ASP.NET MVC 2 application

I'd like to have routes set up as follows: "xyz/" maps to one action method with no parameters, but "xyz/{username}" maps to a different action (in the same controller or not, doesn't matter) that takes an argument called username of type string. Here are my routes so far: routes.MapRoute( "Me", "Profile", new { controller ...

Is it recommended to use ASP.NET user management system on high traffic website

I am reprogramming a high traffic website in asp.net mvc. The client gets about 5 million hits a day. Would like to know if asp.net user management system is suited for this. The site contains over 500K users. ...

ASP.NET MVC: Javascript executing correctly on create view, but not edit view.

I have two views: create and edit. Both share a strongly typed editor template user control. I have a jQuery wysiwyg editor on the shared editor template, and it works fine without errors on the create view, but when I load up the edit view, firefox reports that "$ is not defined" "jquery is not defined" etc. Also, the images from th...

ASP.NET MVC - What is the best way to build a search form that works properly with SEO and users without JS?

I'm working on building a search engine in my application, and because I don't want to have a Querystring in my URL, I'm currently using Javascript to submit the searchTerms for me. Basically I am NOT using a "form", but rather just an input <input id="searchBox" class="search" name="searchTerm" tabindex="1" onfocus=" this.className = ...

Membership.Provider And Asp.NET MVC2: Do I Really Need it?

I see a lot of articles and posts on how to create a custom MembershipProvider, but haven't found any explanation as to why I must/should use it in my MVC2 web app. Apart from "Hey, security is hard!", what are critical parts of the whole MembershipProvider subsystem that I should know about that I don't, because I've only read about how...

How to call Application_Start() from TestInitialize method?

Hi, I am working with unit testing for MVC application using visual studio's test project. I need to call Application_start() method from my TestInitialise method of unit test, as my Application_Start initialises some global values which are required for my app. I have also copied necessaty info from web.config to app.config of my test ...

How do I use VaryByParam with multiple parameters?

In ASP.NET MVC2 I use OutputCache and the VaryByParam attribute. I got it working fine with a single parameter, but what is the correct syntax when I have several parameters on the method? [OutputCache(Duration=30, VaryByParam = "customerId"] Public ActionResult Index(int customerId) { //I've got this one under control, since it only ha...

Why is there no intellisense in ASP.Net MVC 2.0 when assigning Model values to JavaScript?

I'm trying to add some Model properties into my JavaScript within my content page: $(document).ready(function () { createPager(1, <%=Model.TotalPages %>); createUnprocessedPager(1, <%=Model.TotalUnprocessedPages %>); }); Does anyone know if this is by design? Are you not meant to combine Model properties with JavaScript? Or is...