protected override void DoRender(HtmlTextWriter output)
        {
            var loggingService = ObjectFactory.Instance.Resolve <ILoggingService>();
            var stopwatch      = new Stopwatch();

            loggingService.Debug <ProductsMultilistWithSearch>("Starting ProductsMultilistWithSearch.DoRender() ...");

            stopwatch.Start();

            ArrayList         selected;
            OrderedDictionary unselected;

            GetSelectedItems(GetItems(ScContext.ContentDatabase.GetItem(ItemID)), out selected, out unselected);
            var stringBuilder = new StringBuilder();

            foreach (DictionaryEntry dictionaryEntry in unselected)
            {
                var obj = dictionaryEntry.Value as Item;
                if (obj != null)
                {
                    stringBuilder.Append(obj.DisplayName + ",");
                    stringBuilder.Append(GetItemValue(obj) + ",");
                }
            }

            output.Write(
                "<input type='hidden' width='100%' id='multilistValues{0}' value='{1}' style='width: 200px;margin-left:3px;'>",
                ClientID, stringBuilder);
            ServerProperties["ID"] = ID;
            string str1 = string.Empty;

            if (ReadOnly)
            {
                str1 = " disabled='disabled'";
            }
            output.Write("<input id='" + ID + "_Value' type='hidden' value='" + StringUtil.EscapeQuote(Value) + "' />");
            output.Write("<table" + GetControlAttributes() + ">");
            output.Write("<tr>");
            output.Write("<td class='scContentControlMultilistCaption' width='50%'>" + Translate.Text("All") + "</td>");
            output.Write("<td width='20'>" + Images.GetSpacer(20, 1) + "</td>");
            output.Write("<td class='scContentControlMultilistCaption' width='50%'>" + Translate.Text("Selected") +
                         "</td>");
            output.Write("<td width='20'>" + Images.GetSpacer(20, 1) + "</td>");
            output.Write("</tr>");
            output.Write("<tr>");
            output.Write("<td valign='top' height='100%'>");
            output.Write(
                "<div style='width:200%;overflow:hidden;height:30px'><input type='text' width='100%' class='scIgnoreModified bucketSearch inactive' value='" +
                TypeHereToSearch + "' id='filterBox" + ClientID + "' " +
                (ScContext.ContentDatabase.GetItem(ItemID).Access.CanWrite() ? string.Empty : "disabled") + ">");
            output.Write("<span id='prev" + ClientID +
                         "' class='hovertext' style='cursor:pointer;' onMouseOver=\"this.style.color='#666'\" onMouseOut=\"this.style.color='#000'\"> <img width='10' height='10' src='/sitecore/shell/Applications/Buckets/images/right.png' style='margin-top: 1px;'> " +
                         Translate.Text("prev") + " |</span>");
            output.Write("<span id='next" + ClientID +
                         "' class='hovertext' style='cursor:pointer;' onMouseOver=\"this.style.color='#666'\" onMouseOut=\"this.style.color='#000'\"> " +
                         Translate.Text("next") +
                         " <img width='10' height='10' src='/sitecore/shell/Applications/Buckets/images/left.png' style='margin-top: 1px;'>  </span>");
            output.Write("<span id='refresh" + ClientID +
                         "' class='hovertext' style='cursor:pointer;' onMouseOver=\"this.style.color='#666'\" onMouseOut=\"this.style.color='#000'\"> " +
                         Translate.Text("refresh") +
                         " <img width='10' height='10' src='/sitecore/shell/Applications/Buckets/images/refresh.png' style='margin-top: 1px;'>  </span>");
            output.Write("<span id='goto" + ClientID +
                         "' class='hovertext' style='cursor:pointer;' onMouseOver=\"this.style.color='#666'\" onMouseOut=\"this.style.color='#000'\"> " +
                         Translate.Text("go to item") +
                         " <img width='10' height='10' src='/sitecore/shell/Applications/Buckets/images/text.png' style='margin-top: 1px;'>  </span>");
            output.Write("<span style='padding-left:34px;'><strong>" + Translate.Text("Page Number") +
                         ": </strong></span><span id='pageNumber" + ClientID + "'></span></div>");
            string str2 = !UIUtil.IsIE() || UIUtil.GetBrowserMajorVersion() != 9 ? "10" : "11";

            output.Write("<select id=\"" + ID +
                         "_unselected\" class=\"scContentControlMultilistBox\" multiple=\"multiple\" size=\"" + str2 +
                         "\"" +
                         str1 + " >");
            foreach (DictionaryEntry dictionaryEntry in unselected)
            {
                var obj = dictionaryEntry.Value as Item;
                if (obj != null)
                {
                    var str3 = OutputString(obj);
                    output.Write("<option value='" + GetItemValue(obj) + "'>" + str3 + "</option>");
                }
            }

            output.Write("</select>");
            output.Write("</td>");
            output.Write("<td valign='top'>");
            output.Write(
                "<img class='' height='16' width='16' border='0' alt='' style='margin: 2px;' src='/sitecore/shell/themes/standard/Images/blank.png'/>");
            output.Write("<br />");
            RenderButton(output, "Core/16x16/arrow_blue_right.png", string.Empty, "btnRight" + ClientID);
            output.Write("<br />");
            RenderButton(output, "Core/16x16/arrow_blue_left.png", string.Empty, "btnLeft" + ClientID);
            output.Write("</td>");
            output.Write("<td valign='top' height='100%'>");
            output.Write("<select style='margin-top:28px' id='" + ID +
                         "_selected' class='scContentControlMultilistBox' multiple='multiple' size='" + str2 + "'" +
                         str1 + ">");

            var dataProvider = ObjectFactory.Instance.Resolve <ISitecoreContext>().DataProviderMaster;

            for (int index = 0; index < selected.Count; ++index)
            {
                var obj1 = selected[index] as Item;
                if (obj1 != null)
                {
                    string str3 = OutputString(obj1);
                    output.Write("<option value='" + GetItemValue(obj1) + "'>" + str3 + "</option>");
                }
                else
                {
                    var path = selected[index] as string;
                    if (path != null)
                    {
                        var    id   = new ShortID(path);
                        Item   obj2 = GetItemFromId(id.ToID(), dataProvider);
                        string str3 = obj2 == null
                            ? path + ' ' + Translate.Text("[Item not found]")
                            : OutputString(obj2);
                        output.Write("<option value='" + path + "'>" + str3 + "</option>");
                    }
                }
            }

            output.Write("</select>");
            output.Write("</td>");
            output.Write("<td valign='top'>");
            output.Write(
                "<img class='' height='16' width='16' border='0' alt='' style='margin: 2px;' src='/sitecore/shell/themes/standard/Images/blank.png'/>");
            output.Write("<br />");
            RenderButton(output, "Core/16x16/arrow_blue_up.png", "javascript:scContent.multilistMoveUp('" + ID + "')",
                         "btnUp" + ClientID);
            output.Write("<br />");
            RenderButton(output, "Core/16x16/arrow_blue_down.png",
                         "javascript:scContent.multilistMoveDown('" + ID + "')", "btnDown" + ClientID);
            output.Write("</td>");
            output.Write("</tr>");
            output.Write(
                "<div style='border:1px solid #999999;font:8pt tahoma;display:none;padding:2px;margin:4px 0px 4px 0px;height:14px' id='" +
                ID + "_all_help'></div>");
            output.Write(
                "<div style='border:1px solid #999999;font:8pt tahoma;display:none;padding:2px;margin:4px 0px 4px 0px;height:14px' id='" +
                ID + "_selected_help'></div>");
            output.Write("</table>");
            RenderScript(output);

            stopwatch.Stop();
            loggingService.Debug <ProductsMultilistWithSearch>(
                string.Format("ProductsMultilistWithSearch.DoRender() took {0} ms", stopwatch.ElapsedMilliseconds));
        }