Parameters used in a Toggle Button/Radio Button RadButton control

2 posts, 0 answers
  1. Armysniper
    Armysniper avatar
    61 posts
    Member since:
    Mar 2005

    Posted 20 Jul 2013 Link to this post

    I have two RadButton controls setup as Radio button toggle buttons. Code below:
    <telerik:RadButton ID="optOrgPosting" ClientIDMode="AutoID" runat="server" GroupName="PostingType" ToggleType="Radio" OnClientClicked="onPostingTypeChanged" Text="I am posting for my nonprofit organization/public school/university." AutoPostBack="False" ButtonType="ToggleButton" Skin="Silk"></telerik:RadButton>
    <br />
    <telerik:RadButton ID="optSFPosting" ClientIDMode="AutoID" runat="server" GroupName="PostingType" ToggleType="Radio" OnClientClicked="onPostingTypeChanged" Text="I am a search firm, advertising firm, consultant or other company posting on behalf of a nonprofit organization." AutoPostBack="False" ButtonType="ToggleButton" Skin="Silk"></telerik:RadButton>


    I want to setup an OnClientClicked event JavaScript function to fire that will hide or show controls based on which of the two controls are displayed. Nothing too hard. What are the parameters passed into the OnClientClicked event and how can I get the Id of the control that was clicked?

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 22 Jul 2013 Link to this post

    Hi,

    The OnClientClicked event handler receives two parameters:
    1. The instance of the clicked RadButton control

    2. An eventArgs parameter of type Telerik.Web.UI.RadButtonEventArgs, containing the following properties and methods:

      • IsSplitButtonClick () - returns a bool value that indicates whether the split button or the main button is clicked. True means the split button was clicked.

      • get_commandName() - returns the value assigned to the RadButton's CommandName property

      • get_commandArgument() - returns the value assigned to the RadButton's CommandArgument property


    Please try the following code I tried to get the ID of the button clicked.

    JavaScript:
    <script type="text/javascript">
        function onPostingTypeChanged(sender, args) {
            var clickedbuttonid = sender.get_id();
        }
    </script>

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top