Web Designer Friendly Web Parts

March 8 2010 4 comments


My colleague, Lauri, went further after we discussed the method described in this article, and he generalized the process of making Visual Web Parts. I really like his approach more, as it also solves the problems with web part connections and the “double refreshing” problem, so please consider this article as obsolete and look at the better approach.

Web Designer friendly web parts, or web parts that are developed using web designer editable user controls, is a very old problem, and the web is already full of the solutions. One of the most known solutions is SmartPart for SharePoint. We had some issues of not-invented-here syndrome here at Sininen Meteoriitti, so we developed our own code to overcome the same problem. The code is very simple:

public class XxxWebPart : WebPart
    protected override void CreateChildControls()
        var control = Page.LoadControl(

        control.Init += (sender, e) =>
            var uc = control as XxxUserControl;

            if (uc == null && control is PartialCachingControl)
                uc = ((PartialCachingControl)control).CachedControl as

            if (uc == null) return;

            // Pass Web Part properties etc. to the user controls here:
            // (the code below is provided as an example)
            uc.MaxItems = 10;
            uc.SearchScope = "All Sites";

Popularity: 8% [?]

4 comments to “Web Designer Friendly Web Parts”

  1. [...] discussed an approach for creating Web Parts backed by a single user control in a previous post. While the approach works, it’s not quite perfect [...]

  2. You have made some really good points there. I looked on the
    net for more inhfo about the issue annd fkund most people will go
    along with your views oon this site.

  3. Amy says:

    Thanks for your blog post. After attending SharePoint Saturday Ottawa (Canada), I was wrdoening if our organization could jump to SP2013 instead of 2010 in 2013 (the year). Since demos showed improvements in the social tools, I thought that most of our users would adopt SP more quickly and completely. Your revelation about limited user documentation makes me want to waver but who reads the documentation anyway? Regardless of which version, I hope to have guidance from a SharePoint consultant with best practices, revisiting governance and getting it right.

  4. Beneficial facts. Privileged us I ran across your blog by accident, using this program .. web page designer stunned the reason why this kind of coincidence decided not to happened before hand! We book marked that.

Leave a Reply