Example #1
0
        /// <summary>
        /// Processes the HTML element that represents a new object.
        /// </summary>
        protected string CreateControl(ResolvedControl control)
        {
            string name;

            if (control.Metadata.VirtualPath == null)
            {
                // compiled control
                name = EmitCreateControl(control.Metadata.Type, control.ConstructorParameters);
            }
            else
            {
                // markup control
                name = emitter.EmitInvokeControlBuilder(control.Metadata.Type, control.Metadata.VirtualPath);
            }
            emitter.RegisterDotvvmProperties(name);
            // set unique id
            emitter.EmitSetDotvvmProperty(name, Internal.UniqueIDProperty, name);

            if (control.DothtmlNode != null && control.DothtmlNode.Tokens.Count > 0)
            {
                // set line number
                emitter.EmitSetDotvvmProperty(name, Internal.MarkupLineNumberProperty, control.DothtmlNode.Tokens.First().LineNumber);
            }

            return(name);
        }
Example #2
0
        /// <summary>
        /// Processes the HTML element that represents a new object.
        /// </summary>
        protected string CreateControl(ResolvedControl control)
        {
            string name;

            if (control.Metadata.ControlBuilderType == null)
            {
                // compiled control
                name = emitter.EmitCreateObject(control.Metadata.Type, control.ConstructorParameters);
            }
            else
            {
                // markup control
                name = emitter.EmitInvokeControlBuilder(control.Metadata.Type, control.Metadata.VirtualPath);
            }
            // set unique id
            emitter.EmitSetDotvvmProperty(name, Internal.UniqueIDProperty, name);

            if (control.DothtmlNode != null && control.DothtmlNode.Tokens.Count > 0)
            {
                // set line number
                emitter.EmitSetDotvvmProperty(name, Internal.MarkupLineNumberProperty, control.DothtmlNode.Tokens.First().LineNumber);
            }

            if (control.HtmlAttributes != null && control.Metadata.HasHtmlAttributesCollection)
            {
                ProcessHtmlAttributes(name, control.HtmlAttributes, control.DataContextTypeStack);
            }
            return(name);
        }