Create ToggleStates collection programmatically

2 posts, 0 answers
  1. Fit2Page
    Fit2Page avatar
    376 posts
    Member since:
    Feb 2007

    Posted 05 Mar 2012 Link to this post

    Hi all,

    How do I create a ToggleStates collection for a dynamic created ToggleButton?

    I want these 2  comined from codebehind:

            Dim radButton1 As New RadButton()
            radButton1.ButtonType = RadButtonType.ToggleButton
            radButton1.ToggleType = ButtonToggleType.CheckBox
            radButton1.AutoPostback = False
                            '<telerik:RadButtonToggleState ImageUrl="img/play/play.png" HoveredImageUrl="img/play/playHov.png"
                               'Text="Play" Selected="true" />
                            '<telerik:RadButtonToggleState ImageUrl="img/play/pause.png" HoveredImageUrl="img/play/pauseHov.png"
                                'Text="Pause" />

  2. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 05 Mar 2012 Link to this post

    Hello Fit2Page,

    All you need to do is create RadButtonToggleState objects and just add them to the ToggleStates collection of the RadButton. Like so:

    Dim state1 As New RadButtonToggleState("Play")
    Dim state2 As New RadButtonToggleState("Pause")

    The above code is a simple implementation where I just pass the text for the button, but you can add the other properties as well.

    I hope that helps.
Back to Top