LinkButton

in namespace DotVVM.Framework.Controls

Renders the hyperlink which behaves like a button.

Usage & Scenarios

Renders the hyperlink which behaves like a button.

Sample 1: Basic LinkButton

The LinkButton control can use the Text property or the inner content to specify what's inside.

The Click event specifies, which method in the viewmodel will be triggered.

<dot:LinkButton Click="{command: DoSomething()}" Text="Simple Link Button" />

<dot:LinkButton Click="{command: DeleteSomething()}">
  <img src="~/images/delete.png" /> Delete
</dot:LinkButton>
using DotVVM.Framework.ViewModel;

namespace DotvvmWeb.Views.Docs.Controls.builtin.LinkButton.sample1
{
    public class ViewModel : DotvvmViewModelBase
    {
        public void DoSomething()
        {
            // do what you have to do
        }

        public void DeleteSomething()
        {
            // do what you have to do
        }
    }
}

Sample 2: Disable or Hide the LinkButton

To disable or enable the button, use the Enabled property. It supports the data-binding.

It's also possible to hide the button completely by using the Visible property.

<dot:LinkButton Click="{command: Switch()}" Text="Switch"/>

<dot:LinkButton Click="{command: DoSomething()}" Text="Link Button with Enabled binding" Enabled="{value: Enabled}"/>

<dot:LinkButton Click="{command: DoSomething()}" Text="Link Button with Visible binding" Visible="{value: Enabled}"/>
using DotVVM.Framework.ViewModel;

namespace DotvvmWeb.Views.Docs.Controls.builtin.LinkButton.sample2
{
    public class ViewModel : DotvvmViewModelBase
    {
        public bool Enabled { get; set; } = true;

        public void Switch()
        {
            Enabled = !Enabled;
        }

        public void DoSomething()
        {
            
        }

    }
}

Properties

Name Type Description Notes Default Value
property icon Enabled Boolean Gets or sets a value indicating whether the button is enabled and can be clicked on.
attribute
inner element
static value
bindable
default
True
property icon Text String Gets or sets the text on the button.
attribute
inner element
static value
bindable
default
property icon TextOrContentCapability TextOrContentCapability
attribute
inner element
static value
bindable
default
null

Events

Name Type Description
event icon Click Command Gets or sets the command that will be triggered when the button is clicked.

HTML produced by the control

The control renders a hyperlink:

<a href="#" onclick="...">Text or inner content</a>