Exemple #1
0
 public string RenderHeader(int headerDeep)
 {
     var th = new TagBuilder("th");
     if (!ColumnWidth.IsNullOrEmpty())
     {
         th.Attributes.Add("style", "width:" + ColumnWidth);
     }
     if (ColumnName.IsNullOrEmpty())
     {
         ColumnName = FieldName;
     }
     if (Sortable)
     {
         th.InnerHtml = "<a href=\"javascript:void(0);\" sortField=\"" + FieldName + "\" >" + ColumnName + "</a>";
     }
     else
     {
         th.InnerHtml = ColumnName;
     }
     if (Children.IsNullOrEmpty())
     {
         th.Attributes.Add("rowspan", headerDeep.ToString());
     }
     else
     {
         th.Attributes.Add("colspan", Colspan.ToString());
     }
     return th.ToString();
 }
Exemple #2
0
        public override string Render()
        {
            var    td          = new TagBuilder("td");
            var    returnValue = GetValue();
            string innerHtml   = string.Empty;

            if (returnValue != null)
            {
                if (returnValue is CustomTd)
                {
                    var temp = returnValue as CustomTd;
                    foreach (var a in temp.Attribute)
                    {
                        td.Attributes.Add(a.Key, a.Value);
                    }
                    innerHtml = temp.Value.ToString();
                }
                else
                {
                    innerHtml = returnValue.ToString();
                }
            }
            if (ShowLength != 0 && innerHtml.Length > ShowLength)
            {
                td.Attributes.Add("title", innerHtml);
                innerHtml = innerHtml.Substring(ShowLength, "..");
            }
            td.InnerHtml = HtmlEncode ? HttpUtility.HtmlEncode(innerHtml) : innerHtml;
            if (TextAlign != CellTextAlign.Center)
            {
                td.Attributes.Add("align", TextAlign.ToString().ToLower());
            }
            if (!ColumnWidth.IsNullOrEmpty())
            {
                td.Attributes.Add("width", ColumnWidth);
            }
            if (Editable)
            {
                td.Attributes.Add("editCtrlId", FieldName);
            }
            return(td.ToString());
        }