Validator Settings

Validator Settings

Controls featured in this example:

  • Sitecore Web Control

Classes featured in this example:

  • Sitecore.Data.Items.Item
  • Sitecore.Configuration.Settings.HtmlEditor
  • Sitecore.Configuration.Settings.Validators
  • Sitecore.StringUtil

C# Web Control Code

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

string automaticUpdate = Sitecore.Configuration.Settings.Validators.AutomaticUpdate.ToString();
string blockingExpiry = Sitecore.Configuration.Settings.Validators.BlockingExpiry.ToString();
string blockingSleep = Sitecore.Configuration.Settings.Validators.BlockingSleep.ToString();
string expiry = Sitecore.Configuration.Settings.Validators.Expiry.ToString();
string updateDelay = Sitecore.Configuration.Settings.Validators.UpdateDelay.ToString();
string updateFrequency = Sitecore.Configuration.Settings.Validators.UpdateFrequency.ToString();
string validatorServiceUrl = Sitecore.Configuration.Settings.HtmlEditor.ValidatorServiceUrl;

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);
string displayName = Sitecore.StringUtil.GetString(item.DisplayName, item.Name);
//using : for colon and ? for question mark and   for space
output.Write("{0}: {1}", "Item", displayName);
output.RenderEndTag(); //P

output.Write("{0}&#63;&#160;{1}", "Automatic Update", "<b>" + automaticUpdate + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Blocking Expiry", "<b>" + blockingExpiry + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Blocking Sleep", "<b>" + blockingSleep + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Expiry", "<b>" + expiry + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Update Delay", "<b>" + updateDelay + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Update Frequency", "<b>" + updateFrequency + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Validator Service Url", "<b>" + validatorServiceUrl + "</b>");
output.RenderEndTag(); //Div

C# Web Control Real-time Output

Item: Validator Settings

Automatic Update? True
Blocking Expiry: 00:00:20
Blocking Sleep: 00:00:00.5000000
Expiry: 00:20:00
Update Delay: 750
Update Frequency: 1000
Validator Service Url: http://validator.w3.org/check