/// <summary>
/// Gets the designer surface init parameters
/// For now they're used for preserving selected items between reloads
/// </summary>
void GetDesignerInitParams(StringBuilder strBuilder)
{
List <string> clientIds = new List <string> (host.Container.Components.Count);
foreach (IComponent comp in host.Container.Components)
{
clientIds.Add((comp as Control).ClientID);
}
var selServ = host.GetService(typeof(ISelectionService)) as ISelectionService;
if (selServ == null)
{
throw new Exception("Could not load selection service");
}
ICollection col = selServ.GetSelectedComponents();
List <string> selectedIds = new List <string> (col.Count);
foreach (IComponent comp in col)
{
selectedIds.Add((comp as Control).ClientID);
}
System.Web.Script.Serialization.JavaScriptSerializer jsonizer = new System.Web.Script.Serialization.JavaScriptSerializer();
strBuilder.AppendFormat("<div id=\"{0}\" style=\"display:none;\"> ", DesignerNames.ElementInitContClass);
strBuilder.AppendFormat("<span id=\"{0}\">", DesignerNames.ElementSelectableContClass);
jsonizer.Serialize(clientIds.ToArray(), strBuilder);
strBuilder.Append("</span>");
strBuilder.AppendFormat("<span id=\"{0}\">", DesignerNames.ElementSeletectedContClass);
jsonizer.Serialize(selectedIds.ToArray(), strBuilder);
strBuilder.Append("</span>");
strBuilder.Append("</div>");
}