This blog will show you how to setup your Textboxes on a Sitefinity form with input validation. If you've been working with previous versions of Sitefinithy the first question you may have is "wait a minute, Sitefinity has built-in forms?". Yes, Sitefinity 4.0 includes a new Form Builder, which allows you to create form modules that can be shared in multiple pages of your website.  They are very simple to setup and once you have created a form, you just drop a form control on a page and point it to your form. In addition, Sitefinity will automatically persist ...

I was recently working with a CollectionViewSource in a Silverlight project, but needed to display groupings of the data items as ‘Rankings’, that is: sorted by the number of items in each group.  There are a variety of resources out there on how to sort the items in a CollectionViewSource, and even how to sort the items within a group (this one, for example), but less information on how to sort by how many items are in each group.

Let’s take a look at an example CollectionViewSource:  in this case based on a List of DateTime objects representing ...

Few things are more disappointing to an ASP.NET programmer than this one line of code in a web.config:

<sessionState mode="Off" />

You probably know what I mean if you’ve ever been asked to implement user sessions for a web site that has ASP.NET’s built-in session state disabled.  In this post I will offer one simple alternative that allows you to implement user sessions on just such a web site.

Cookies Taste Better In-Memory

The secret to my solution is HTTP cookies.  In my experience, programmers are increasingly afraid to create sites that require cookies because ...

I needed to build a control that would display text in a dynamic way similar to the image below:

But the text is data-driven and the control had to render different text, different highlight colors and different highlighted words based on the object it was bound to.

My first reaction for something like this is to build an IValueConverter class, which would set the Inlines property on a TextBlock like this:

<TextBlock TextBlock.Inlines="{Binding Path=MyDataObject, Converter={StaticResource TextFormattingConverter}}"/>

However, the InlineCollection object that is used for the Inlines property has an internal constructor, so we ...

It has been a month since Sitefinity 4.0 hit the streets. Many miss the features and marketplace extensions for 3.7 that took years to ripen. That’s why today I am going to show you how to migrate your custom modules from Sitefinity 3.7 to 4.0.

For our 3.7 custom module, I will use the Contacts Module sample Ivan built. We should have a Contacts Module for Sitefinity 4.0 by the end of this article. Let us first look at the 3.7 graphic interface and project structure that we will start from:

Notice in the sample there is a completely separate project for ...

I was trying to find out why a Windows Azure Worker Role was having problems, so I enabled, Intellitrace, only to find this broke the RIA Services in the Web Role in that same cloud deployment.

I could see the IntelliTrace log included this very odd error message:

 

Operation could destabilize the runtime

 

Well, we certainly don’t want that to happen!

 

A little research dug up this very helpful blog by Kyle McClellan: http://blogs.msdn.com/b/kylemc/archive/2010/06/09/ria-azure-and-intellitrace.aspx

 

Short story is, that it is a known issue with RIA Services in Azure, turning on Intellitrace on the RIA assemblies is ...

Update: there is a newer version of this procedure at T-SQL Drop If Exists 2.0

When writing SQL upgrade scripts, I often find myself writing this kind of statement:

if (object_id('ExampleProc',  'p')  is  not  null)
     drop  procedure dbo.ExampleProc
GO  create  procedure dbo.ExampleProc
as  -- procedure body
GO

There are many ways to extend classes in .NET languages, but I thought I’d cover just a few of the more common or compelling options here.

Derivation/Inheritance

Perhaps the most common type of extensibility, certainly the most obvious, is creating a class that derives from a base class to add new functionality.  This is called inheritance and has been a part of .NET (and all other OO languages) since the beginning.

class Base
{
    public bool IsBase;

    public Base()
    {
        IsBase = true;
    }
}
          
class Derived : Base
{
    public bool IsDerived;

    public...

I was recently asked to create an ASP.NET 2.0 web site that consumed an OData (WCF Data Services) data feed.  Of course, in .NET 4.0, this would have been easy given the great tool that Microsoft has provided for us in the WCF Data Services Client (System.Data.Services.Client).  However, in .NET 2.0, this presented somewhat of a challenge.

For all the examples in this blog, I’m using Chris Woodruff’s baseballs stats feed located at http://baseball-stats.info/OData/baseballstats.svc/

I decided to write my own simple OData ATOM/XML parser.  But first, I wanted some classes to hold.  Ideally, I wanted classes that ...

Using stored procedures is already built into the Entity Framework but using stored procedures with WCF RIA Services then ultimately Silverlight requires some manual work. In this example I am going to step through adding an entity to an ADO.NET Entity Data Model all the way through calling the stored procedure from Silverlight.

 

First setup a Silverlight project of your liking with and make sure to enable WCF RIA Services.

 

Create a new ADO.NET Entity Data Model in the Web project. Connect this data model to the AdventureWorks2008 sample database. At the Choose Your Database Objects page select the Address table ...