Fix Broken User Manager

June 01, 2011

I've long given up on using the User Manager paging buttons until yesterday when looking over the known issues, I found an article describing a solution to my problem on SDN. Knowing at least one other individual that has had the same issue I thought I'd do a write up to bring attention to it so that the anyone else with the same issue can get back use of their user manager.  

The problem was that on the UserManager, the paging buttons (shown below) simply didn't work.

 user manager paging buttons

With a long list of users I would often cringe at the thought of the day when I wouldn't know the name of the user I was trying to work with and simply had to use the search box to find them. Luckily that day never came and as it turns out the issue was caused by a setting in the web.config which I'd only first found about a year or so ago. I'm talking about the "AutomaticDataBind" setting. If you've ever used repeaters or datagrids and had to debug the page you may have wondered why exactly the event fired twice when a page loaded. This is why. Why Sitecore originally added this into the system is probably a long and mysterious tale, the likes of which we'll never know but it's there and you can use it or not. Apparently the UserManager is negatively affected by this setting and the article I found gives two solutions to resolve the issue: 1). set the AutomaticDataBind setting to false so that it's off, or if like in my case where there's too many custom pieces of code for me to say for sure that something won't break, you can 2). override the CodeBehind class that's running the user manager layout file. To do the latter you would first need to go to the file and change the CodeBehind class path. The file is located at /sitecore/shell/Applications/Security/UserManager/UserManager.aspx. Then you'll need to create a class in your library and compile it. The class you'll need is setup like this:

using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace YourNamespace{    public class UserManager : Sitecore.Shell.Applications.Security.UserManager.UserManager    {        protected override void OnInit(EventArgs e)        {            base.OnInit(e);            //this is used to reset the binding setting after the default was set in the base.OnInit            Sitecore.Context.State.DataBind = false;        }    }}

Now that I can browse through my user list I'm now free to find and purge users that aren't part of the company as well as a list of other housekeeping duties I have to work on. Honestly I'm just glad I don't feel like a utility that I use very often is hobbled anymore. I really like it when I can fix issues like this.