Type Properties

Type Properties

ASP.NET

  • Provides an object-oriented programming model
  • Control-based event driven arthitecture
  • Supports all .NET languages
  • Components are compiled on demand or are precompiled, not interpreted

Notes

  • This code only displays the first ten types

Type Properties C# Web Control Code

Sitecore.Data.Items.Item item = this.GetItem();
if (item == null) return;

System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
if (assembly == null) return;

output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-weight:bold; width:100%; clear:both");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Div);
output.Write("C# Web Control Real-time Output");
output.RenderEndTag();

output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-size:x-small; width:100%; clear:both");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Div);
output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-weight:bold");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.P);
//using : for colon and ? for question mark and   for space
output.Write("{0}: {1}", "Item", item.DisplayName);
output.RenderEndTag(); //P

output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Align, "left");
output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Border, "0");
output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Cellpadding, "3");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Table);
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Thead);
output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Align, "center");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Th);
output.Write("Name");
output.RenderEndTag(); //Th
output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Align, "center");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Th);
output.Write("Class");
output.RenderEndTag(); //Th
output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Align, "center");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Th);
output.Write("Abstract");
output.RenderEndTag(); //Th
output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Align, "center");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Th);
output.Write("Array");
output.RenderEndTag(); //Th
output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Align, "center");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Th);
output.Write("Enum");
output.RenderEndTag(); //Th
output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Align, "center");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Th);
output.Write("Interface");
output.RenderEndTag(); //Th
output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Align, "center");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Th);
output.Write("Public");
output.RenderEndTag(); //Th
output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Align, "center");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Th);
output.Write("Visible");
output.RenderEndTag(); //Th
output.RenderEndTag(); //Thead
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Tbody);

int i = 0;
foreach (System.Type type in assembly.GetTypes())
{
    i++;
    output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Tr);
    output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Align, "left");
    output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Td);
    output.Write("{0}", type.Name);
    output.RenderEndTag(); //Td

    output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Align, "center");
    output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Td);
    if(type.IsClass) output.Write("{0}", "☒");
    else output.Write("{0}", "☐");
    output.RenderEndTag(); //Td

    output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Align, "center");
    output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Td);
    if(type.IsAbstract) output.Write("{0}", "☒");
    else output.Write("{0}", "☐");
    output.RenderEndTag(); //Td

    output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Align, "center");
    output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Td);
    if(type.IsArray) output.Write("{0}", "☒");
    else output.Write("{0}", "☐");
    output.RenderEndTag(); //Td

    output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Align, "center");
    output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Td);
    if(type.IsEnum) output.Write("{0}", "☒");
    else output.Write("{0}", "☐");
    output.RenderEndTag(); //Td

    output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Align, "center");
    output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Td);
    if(type.IsInterface) output.Write("{0}", "☒");
    else output.Write("{0}", "☐");
    output.RenderEndTag(); //Td

    output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Align, "center");
    output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Td);
    if(type.IsPublic) output.Write("{0}", "☒");
    else output.Write("{0}", "☐");
    output.RenderEndTag(); //Td

    output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Align, "center");
    output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Td);
    if(type.IsVisible) output.Write("{0}", "☒");
    else output.Write("{0}", "☐");
    output.RenderEndTag(); //Td

    output.RenderEndTag(); //Tr
    //only display first 10 rows
    if (i >= 10) break;
}
output.RenderEndTag(); //Tbody
output.RenderEndTag(); //Table
output.RenderEndTag(); //Div

Type Properties C# Web Control Output


Name Class Abstract Array Enum Interface Public Visible
Registration
ViewDatabaseCaches
ValidItemNames
ShowSingleLineText
ShowMultiLineText
ShowGrpDroplink
PageRenderings
OrderedList
NumberProperties
MembershipProvider


Sources