/// <summary> /// Builds an Umbraco Macro tag if a user selected a macro /// </summary> /// <returns></returns> private string CreateUmbracoMacroTag() { string result = string.Empty; if (!string.IsNullOrEmpty(SelectedMacroAlias)) { //Only create Macro Tag if we have something to store. StringBuilder sb = new StringBuilder(); //Start sb.Append("<?UMBRACO_MACRO "); //Alias Attribute sb.AppendFormat(" macroalias=\"{0}\" ", SelectedMacroAlias); foreach (PersistableMacroProperty prop in SelectedProperties) { //Make sure we find the correct Unique ID string ControlIdToFind = ID + "_" + prop.Alias; string value = MacroControlFactory.GetValueFromMacroControl(_formTable.FindControl(ControlIdToFind)); sb.AppendFormat(" {0}=\"{1}\" ", prop.Alias, value); } sb.Append(" />"); result = sb.ToString(); } return(result); }
/// <summary> /// Renders a from based on the properties of the macro /// </summary> private void RendeFormControls() { foreach (PersistableMacroProperty prop in SelectedProperties) { //Create Literal Literal caption = new Literal(); caption.ID = ID + "_" + string.Format("{0}Label", prop.Alias); caption.Text = prop.Name; //Get the MacroControl Control macroControl = MacroControlFactory.GetMacroRenderControlByType(prop, ID + "_" + prop.Alias); AddFormRow(caption, macroControl); } }