Beispiel #1
0
        protected override void AddAttributesToRender(IHtmlWriter writer, IDotvvmRequestContext context)
        {
            RouteLinkHelpers.WriteRouteLinkHrefAttribute(this, writer, context);

            writer.AddKnockoutDataBind("text", this, TextProperty, () => {
                shouldRenderText = true;
            });

            var enabledBinding = GetValueRaw(EnabledProperty);

            if (enabledBinding is bool)
            {
                WriteEnabledBinding(writer, (bool)enabledBinding);
            }
            else if (enabledBinding is IValueBinding)
            {
                WriteEnabledBinding(writer, (IValueBinding)enabledBinding);
            }

            if (GetValue <bool?>(EnabledProperty) == false)
            {
                writer.AddAttribute("disabled", "disabled");
            }

            WriteOnClickAttribute(writer, context);

            base.AddAttributesToRender(writer, context);
        }
Beispiel #2
0
        protected override void AddAttributesToRender(IHtmlWriter writer, RenderContext context)
        {
            RouteLinkHelpers.WriteRouteLinkHrefAttribute(RouteName, this, writer, context);

            writer.AddKnockoutDataBind("text", this, TextProperty, () =>
            {
                shouldRenderText = true;
            });

            base.AddAttributesToRender(writer, context);
        }
Beispiel #3
0
        protected override void AddAttributesToRender(IHtmlWriter writer, IDotvvmRequestContext context)
        {
            RouteLinkHelpers.WriteRouteLinkHrefAttribute(RouteName, this, UrlSuffixProperty, writer, context);

            writer.AddKnockoutDataBind("text", this, TextProperty, () =>
            {
                shouldRenderText = true;
            });

            var enabledBinding = GetValueRaw(EnabledProperty);

            if (enabledBinding is bool)
            {
                WriteEnabledBinding(writer, (bool)enabledBinding);
            }
            else if (enabledBinding is IValueBinding)
            {
                WriteEnabledBinding(writer, (IValueBinding)enabledBinding);
            }

            base.AddAttributesToRender(writer, context);
        }