MVC: Accessing Form Values

Please see my other MVC articles. Leveraging the FormCollection object to retrieve user input. Collecting user input is one of the most common deliverables in Internet applications for which MVC provides a robust mechanism called the FormCollection. Beginning where my MVC 4 ADO.NET Entity Data Model article ended, I will demonstrate how to leverage FormCollection…

MVC: Using CSS Classes with Textboxes

Please see my other MVC articles. Leveraging CSS classes to Style Html Textboxes. As with any standard-compliant, cross-browser Internet applications, it is imperative code used to impose styling remain separate from the UI markup. Therefore, MVC supports the following ability for designers to add a CSS class to input controls which may be styled in…

MVC: Displaying Data Source Records

Please see my other MVC articles. Leveraging the Data Model to Retrieve Records for Display. As illustrated in MVC 4 ADO.NET Entity Data Model, Visual Studio now provides an extremely efficient ORM tool to quickly generate the data layer for CRUD operations. In this article, I will illustrate how to query and display data from…

MVC: Providing an Input Form

Please see my other MVC articles. Leveraging the Html form object to receive user input. Collecting user input is one of the most common deliverables in Internet applications for which MVC provides the Html object to automatically display HTML input control matching attributes of a data Model. First, I’ll create a new View which houses…

MVC: Class Diagram – Building a Class

Please see my other MVC articles. Leveraging a GUI tool to quickly construct a class. In this article I will demonstrate Visual Studio’s Class Diagram tool which allows developers to quickly construct a C# class with much less errors. First, I’ll create a new model class to demonstrate this feature. Next, I’ll invoke the tool.…

MVC: Bundles

Please see my other MVC articles. Instantiating Script and Style References Efficiently Including references to script and style tags has always been a tedious and time-consuming web development task. Now MVC 4 provides an alternate method by allowing developers to “bundle” files together into a single reference which may then be referenced to “render” them…

MVC: Customized Grid

Please see my other MVC articles. Leveraging the MVC Grid to quickly display sortable, paging data. MVC provides robust data controls for displaying data sets. These grids come with many customizable features and require very little coding. To illustrate this feature, I’ll begin a Model for Sales Associates. Next, I’ll create a Controller which seeds…

TDD: Testing with Stub Methods

Please see my other Test Driven Development articles. Adding flexibility to return values using Stub methods. Continuing on my “Testing with Dummy objects” article, you might have noticed a limitation with regards to the return value – only one was allowed. In situations where multiple return values are needed, Stub methods provide an alternative. In…

TDD: Refactoring with Polymorphism

Please see my other Test Driven Development articles. Using polymorphism to refactor SRP violations. Single Responsibility Principle (SRP) violations are one of the most common issues found in code. Either the class or its behavior is attempting to fulfill more than one primary purpose. In this example, I will illustrate how polymorphism provides a powerful…

TDD: Mocking with Dummy Objects

Please see my other Test Driven Development articles. Using custom objects in place of a mocking framework. When it’s desired to avoid the overhead of a mocking framework and its functionality isn’t required, developers may elect to provide their own dummy objects instead. In this article I will illustrate a simple example of writing my…