C#
LINQ: ToLookup
ToLookup is an extension method in Linq which returns a data structure comprising of key value pairs. It’s similar to the ToDictionary extensions method. However, the main difference is that it can contain multiple keys of the same value while a dictionary has to have distinct keys. Lets look at an example. void Main() { [...]
Windows Azure Basics: What you should know
While developing Windows Azure Applications it’s important to get a firm grip of the basic terminology associated with Azure.Here is a list of the most important terms you need to be familiar with in order to begin Windows Azure development. WebRoles & WorkerRoles: Every Azure application consists of roles in the form of either WebRoles or WorkerRoles.Web [...]
How To: Communication between UserControls
Problem : Allow one UserControl(DepartmentSelectorControl) to communicate /pass a value to another UserControl which will in turn using System; using System.Linq; using System.Web.UI.WebControls; public partial class Controls_DepartmentSelectorControl : System.Web.UI.UserControl { private string selecteddepartment = string.Empty; public string SelectedDepartment { get { return selecteddepartment; } set { selecteddepartment = value; selecteddepartment = uxDepartments.SelectedItem.Text; } } [...]
Retrieving Editable Regions in Kentico
Problem : Retrieve contents of editable regions in Kentico Kentico CMS allows you to use a custom control called CMSEditableRegion. There are times when you might need to check the contents of this region and perform some checks to implement business rules. Solution : Check for the EditableRegion property on the Current document Each document [...]
How to generate an iCalendar file
Problem : Generate a iCalendar file which will trigger a calendar application (eg. outlook) to open with an updated event. The iCalendar file is a fairly common feature which most developers add to enable users to add events to their personalized calendars via a custom calendar application Solution : Create a web handler which will [...]
Eliminating if-else statements using a rule engine
Most of you, like me have run into the dreaded long chain of if-else statements while developing. These chain of conditional statements often make code very difficult to read and debug. While working on a recent project I discovered a new way to clean things up. I’ll first take you through the old approach private [...]