Archives

Archives / 2014 / May
  • Dealing with Multiple Instances of Partial Views and Model Binding in ASP.NET MVC

    ASP.NET model binding is quite powerful and flexible. It caters to most of the scenarios without much configuration from developers. However, at times you may need to intervene in order to achieve the desired model binding effect. One such situation is when you use multiple instance of a partial page on a view. This article shows one possible approach to deal with such situations.

  • Writing C# Code Using SOLID Principles

    Most of the modern programming languages including C# support objected oriented programming. Features such as encapsulation, inheritance, overloading and polymorphism are code level features. Using these features is just one part of the story. Equally important is to apply some object oriented design principles while writing your C# code. SOLID principles is a set of five such principles--namely Single Responsibility Principle, Open/Closed Principle, Liskov Substitution Principle, Interface Segregation Principle and Dependency Inversion Principle. Applying these time proven principles make your code structured, neat and easy to maintain. This article discusses SOLID principles and also illustrates how they can be applied to your C# code.

  • Cascading DropDownLists using "Eager Loading" on client side

    One of my earlier articles shows how to create cascading DropDownLists by making Ajax calls to the MVC action methods. While that approach is quite common and popular recently a reader asked whether something similar can be done without making any Ajax calls. If you want to implement cascading dropdownlists purely on client side then you will need to "eagerly load" all the data needed by them at the time of loading the page. This data can be stored in a hidden field and used as and when needed. Obviously this technique is not suitable for huge amount of data since everything is loaded at once on the client side. However, if the data is small and you understand the implications of loading it in advance here is how you can accomplish the task.

  • 10 Things to Keep in Mind while Developing a New ASP.NET Web Forms Application

    Many developers are opting for ASP.NET MVC for their new web applications. However, this may not be always possible (reasons can be many and valid in a given context) and you might be required to use Web Forms for your new projects. In such cases novice developers have this doubt - "If I develop my project using Web Forms and later want to migrate to MVC, how difficult this task would be?". There is no single answer to this question. However, if you follow certain guidelines while developing a Web Forms project today, at later stage migrating to MVC would be less painful than otherwise. Here I have listed my top 10 recommendations in dealing with such a situation.