The enigma of software development.

Author Archive

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 [...]

Feature Stapling in SharePoint 2010 Part II

  At this point Feature 1 is complete and we are ready to deploy to our sharepoint environment. You should have a solution explorer similar to this:     After you deploy, you can verify that everything worked by doing the following. Navigate to Site Actions -> Site Settings -> Site Collection Administration -> Site [...]

Retrieving the current user in SharePoint 2010 object model

This is a really simple code snippet to obtain the current user using the SharePoint object model. using (SPWeb spweb = SPContext.Current.Web) { SPUser oUser = spweb.CurrentUser; string Username = oUser.LoginName; } SPUser represents a user in SharePoint services. A new object (oUser) is created from the spweb property, currentUser. We can now access various [...]

Free SharePoint Development Tools

Four free SharePoint development tools you should consider using are: CAML Builder from U2U (http://www.u2u.be/Res/Tools/CamlQueryBuilder.aspx): Build and test your CAML queries and paste into your code. CKS (Community Kit for SharePoint, Tools Edition) (http://cksdev.codeplex.com/ ): Makes the SharePoint development cycle tolerable (almost). Version 2 was released May 2011. ULS Viewer (http://archive.msdn.microsoft.com/ULSViewer ) In my opinion, [...]

Using Linq to SharePoint – SPLinq

SPlinq allows you to write strongly typed queries against lists. Here are some key points to note: SharePoint 2010 exposes list data through a REST service that you can consume in your projects. The WCF data service SharePoint exposes is ListData.svc. eg http://sp2010dev/_vti_bin/listdata.svc  You will need the ADO.NET client runtime installed on your machine In [...]

Sharepoint: Cannot convert type ‘Microsoft.SharePoint.WebControls.ScriptLink’ to ‘System.Web.UI.IAttributeAccessor’

I recently ran into this error which working on a custom page. Sharepoint: Cannot convert type ‘Microsoft.SharePoint.WebControls.ScriptLink’ to ‘System.Web.UI.IAttributeAccessor’ Whenever you copy a master page from one site to another in SharePoint designer, it converts certain tags to script. The solution is to cut and paste your code into a new masterpage file. Source: http://www.hexanes.com/?p=448

Previous Posts