当前位置: 首页>>代码示例>>C#>>正文


C# TreeList.RenderControl方法代码示例

本文整理汇总了C#中TreeList.RenderControl方法的典型用法代码示例。如果您正苦于以下问题:C# TreeList.RenderControl方法的具体用法?C# TreeList.RenderControl怎么用?C# TreeList.RenderControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TreeList的用法示例。


在下文中一共展示了TreeList.RenderControl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DoRender

        /// <summary>
        /// Render Script to Page
        /// </summary>
        /// <param name="output">
        /// The output.
        /// </param>
        protected override void DoRender(HtmlTextWriter output)
        {
            IDictionary dictionary;
            ArrayList list;
            var current = Sitecore.Context.ContentDatabase.GetItem(this.ItemID);
            var items = this.GetItems(current);
            this.GetSelectedItems(items, out list, out dictionary);

            #region Rendering filter box

            var sb = new StringBuilder();
            foreach (var item in (from DictionaryEntry entry in dictionary select entry.Value).OfType<Item>())
            {
                sb.Append(item.DisplayName + ",");
                sb.Append(GetItemValue(item) + ",");
            }

            output.Write("<input type=\"hidden\" width=\"100%\" id=\"multilistValues" + ClientID + "\" value=\"" + sb + "\" style=\"width: 200px;margin-left:3px;\">");

            #endregion

            this.ServerProperties["ID"] = this.ID;
            var str = string.Empty;
            if (this.ReadOnly)
            {
                str = " disabled=\"disabled\"";
            }

            output.Write("<input id=\"" + this.ID + "_Value\" type=\"hidden\" value=\"" + StringUtil.EscapeQuote(this.Value) + "\" />");
            output.Write("<table" + this.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%\">");
            var treeViewThing = new TreeList { ID = "DropTreeForBucket" };
            treeViewThing.RenderControl(output);
            output.Write("<input type=\"text\" width=\"100%\" class=\"scIgnoreModified\" style=\"color:gray\" value=\"Type here to search\" id=\"filterBox" + this.ClientID + "\" style=\"width:100%\" " +  (Sitecore.Context.Item.Access.CanWrite() ? "" : "disabled") +">");
            output.Write(@"<span id='prev" + this.ClientID + @"' class='hovertext' style='cursor:pointer;' onMouseOver=""this.style.color='#666'"" onMouseOut=""this.style.color='#000'"">" + " <img width=\"10\" height=\"10\" src=\"/sitecore%20modules/Shell/Sitecore/ItemBuckets/images/right.png\" style=\"margin-top: 1px;\"> prev |" + "</span>");
            output.Write(@"<span id='next" + this.ClientID + @"' class='hovertext' style='cursor:pointer;' onMouseOver=""this.style.color='#666'"" onMouseOut=""this.style.color='#000'""> " + " next <img width=\"10\" height=\"10\" src=\"/sitecore%20modules/Shell/Sitecore/ItemBuckets/images/left.png\" style=\"margin-top: 1px;\">  " + "</span>");
            output.Write(@"<span id='refresh" + this.ClientID + @"' class='hovertext' style='cursor:pointer;' onMouseOver=""this.style.color='#666'"" onMouseOut=""this.style.color='#000'""> " + " refresh <img width=\"10\" height=\"10\" src=\"/sitecore%20modules/Shell/Sitecore/ItemBuckets/images/refresh.png\" style=\"margin-top: 1px;\">  " + "</span>");
            output.Write(@"<span style='padding-left:34px;'><strong>Page Number: </strong></span><span id='pageNumber" + this.ClientID + @"'></span>");
            output.Write("<select id=\"" + this.ID + "_unselected\" class=\"scContentControlMultilistBox\" multiple=\"multiple\" size=\"10\"" + str + " >");
            foreach (DictionaryEntry entry in dictionary)
            {
                var item = entry.Value as Item;
                if (item != null)
                {
                    var outputString = OutputString(item);
                    output.Write("<option value=\"" + this.GetItemValue(item) + "\">" + outputString + "</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 />");
            this.RenderButton(output, "Core/16x16/arrow_blue_right.png", string.Empty);
            output.Write("<br />");
            this.RenderButton(output, "Core/16x16/arrow_blue_left.png", string.Empty);
            output.Write("</td>");
            output.Write("<td valign=\"top\" height=\"100%\">");
            output.Write("<select style=\"margin-top:28px\" id=\"" + this.ID + "_selected\" class=\"scContentControlMultilistBox\" multiple=\"multiple\" size=\"10\"" + str + ">");
            for (int i = 0; i < list.Count; i++)
            {
                var item3 = list[i] as Item;
                if (item3 != null)
                {
                    var outputString = OutputString(item3);
                    output.Write("<option value=\"" + this.GetItemValue(item3) + "\">" + outputString + "</option>");
                }
                else
                {
                    var path = list[i] as string;
                    if (path != null)
                    {
                        string str3;
                        var item4 = Sitecore.Context.ContentDatabase.GetItem(path);
                        if (item4 != null)
                        {
                            var outputString = OutputString(item4);
                            str3 = outputString;
                        }
                        else
                        {
                            str3 = path + ' ' + Translate.Text("[Item not found]");
                        }

                        output.Write("<option value=\"" + path + "\">" + str3 + "</option>");
                    }
//.........这里部分代码省略.........
开发者ID:csteeg,项目名称:Sitecore-Item-Buckets,代码行数:101,代码来源:BucketList.cs


注:本文中的TreeList.RenderControl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。