This is a migrated thread and some comments may be shown as answers.

Parameters used in a Toggle Button/Radio Button RadButton control

1 Answer 253 Views
Button
This is a migrated thread and some comments may be shown as answers.
Raventhorn
Top achievements
Rank 2
Raventhorn asked on 20 Jul 2013, 08:42 PM
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?

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 22 Jul 2013, 07:04 AM
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.
Tags
Button
Asked by
Raventhorn
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Share this question
or