'Telerik Rad Button - How to Disable ToggleType CheckBox Link Click

I need some help with a Telerik RadButton that I have set up to work like a checkbox. It's loading the OnCommand click event each time that it's clicked. I need it to be more of a on/off switch. More details below.

ButtonType="StandardButton" 
    ToggleType="CheckBox"

Current state:

What I need the button to do:

  • normal state (notSelectedButton): stay the same - be clickable and load OnCommand="videoClicked" event. not selected button image
  • selected/checked state (selectedButton): be clickable but disable OnCommand event. I want it to go back to normal state (like an on/off switch). selected button image

My example code below shows what I have so far. I don't know if this should be done client side or code behind? Any suggestions are welcomed.

aspx code:

<ItemTemplate>
  <div class="itemWrapper">
    <telerik:RadButton 
    RenderMode="Lightweight" 
    runat="server" 
    OnCommand="videoClicked" 
    CommandArgument='<%# Eval("videoId") %>' 
    ButtonType="StandardButton" 
    ToggleType="CheckBox" 
    ID="RadToggleButton1" 
    AutoPostBack="true">
      <ToggleStates>
        <telerik:RadButtonToggleState SecondaryIconCssClass="rbOk" Text="Selected" Value="selectedButton"></telerik:RadButtonToggleState>
        <telerik:RadButtonToggleState Text="Not Selected" Value="notSelectedButton"></telerik:RadButtonToggleState>
      </ToggleStates>
    </telerik:RadButton>
  </div>
</ItemTemplate>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source